diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings')
40 files changed, 0 insertions, 5560 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java deleted file mode 100644 index e441151167..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings; - -import org.eclipse.osgi.util.NLS; - -/** - * The localized strings used by the mapping panes. - * - * @version 2.2 - * @since 1.0 - */ -@SuppressWarnings("nls") -public class EclipseLinkUiMappingsMessages extends NLS { - - public static String BasicCollectionMappingUiProvider_label; - public static String BasicCollectionMappingUiProvider_linkLabel; - - public static String BasicMapMappingUiProvider_label; - public static String BasicMapMappingUiProvider_linkLabel; - - public static String TransformationMappingUiProvider_label; - public static String TransformationMappingUiProvider_linkLabel; - - public static String VariableOneToOneMappingUiProvider_label; - public static String VariableOneToOneMappingUiProvider_linkLabel; - - public static String CacheTypeComposite_label; - public static String CacheTypeComposite_full; - public static String CacheTypeComposite_weak; - public static String CacheTypeComposite_soft; - public static String CacheTypeComposite_soft_weak; - public static String CacheTypeComposite_hard_weak; - public static String CacheTypeComposite_cache; - public static String CacheTypeComposite_none; - public static String EclipseLinkTypeMappingComposite_advanced; - public static String EclipseLinkTypeMappingComposite_caching; - public static String EclipseLinkTypeMappingComposite_converters; - - public static String CacheSizeComposite_size; - public static String CacheCoordinationTypeComposite_label; - public static String CacheCoordinationTypeComposite_send_object_changes; - public static String CacheCoordinationTypeComposite_invalidate_changed_objects; - public static String CacheCoordinationTypeComposite_send_new_objects_with_changes; - public static String CacheCoordinationTypeComposite_none; - - public static String CachingComposite_sharedLabelDefault; - public static String CachingComposite_sharedLabel; - public static String CachingComposite_advanced; - public static String AlwaysRefreshComposite_alwaysRefreshDefault; - public static String AlwaysRefreshComposite_alwaysRefreshLabel; - public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault; - public static String RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel; - public static String DisableHitsComposite_disableHitsDefault; - public static String DisableHitsComposite_disableHitsLabel; - - public static String ChangeTrackingComposite_label; - public static String ChangeTrackingComposite_attribute; - public static String ChangeTrackingComposite_object; - public static String ChangeTrackingComposite_deferred; - public static String ChangeTrackingComposite_auto; - - public static String ConvertComposite_converterNameLabel; - public static String ConvertComposite_defineConverterSection; - public static String ConvertComposite_default; - public static String ConvertComposite_custom; - public static String ConvertComposite_type; - public static String ConvertComposite_objectType; - public static String ConvertComposite_struct; - - public static String ConverterComposite_nameTextLabel; - public static String ConverterComposite_classLabel; - - public static String ConvertersComposite_customConverter; - public static String ConvertersComposite_objectTypeConverter; - public static String ConvertersComposite_structConverter; - public static String ConvertersComposite_typeConverter; - - public static String CustomizerComposite_classLabel; - - public static String TypeSection_converted; - - public static String ExistenceCheckingComposite_label; - public static String JavaExistenceCheckingComposite_check_cache; - public static String JavaExistenceCheckingComposite_check_database; - public static String JavaExistenceCheckingComposite_assume_existence; - public static String JavaExistenceCheckingComposite_assume_non_existence; - public static String OrmExistenceCheckingComposite_check_cache; - public static String OrmExistenceCheckingComposite_check_database; - public static String OrmExistenceCheckingComposite_assume_existence; - public static String OrmExistenceCheckingComposite_assume_non_existence; - - public static String ExpiryComposite_expirySection; - public static String ExpiryComposite_noExpiry; - public static String ExpiryComposite_timeToLiveExpiry; - public static String ExpiryComposite_timeToLiveExpiryExpireAfter; - public static String ExpiryComposite_timeToLiveExpiryMilliseconds; - public static String ExpiryComposite_dailyExpiry; - public static String ExpiryComposite_timeOfDayExpiryExpireAt; - - public static String JoinFetchComposite_label; - public static String JoinFetchComposite_inner; - public static String JoinFetchComposite_outer; - - public static String MutableComposite_mutableLabel; - public static String MutableComposite_mutableLabelDefault; - public static String MutableComposite_true; - public static String MutableComposite_false; - - public static String ObjectTypeConverterComposite_dataTypeLabel; - public static String ObjectTypeConverterComposite_objectTypeLabel; - public static String ObjectTypeConverterComposite_conversionValueEdit; - public static String ObjectTypeConverterComposite_conversionValuesDataValueColumn; - public static String ObjectTypeConverterComposite_conversionValuesObjectValueColumn; - public static String ObjectTypeConverterComposite_defaultObjectValueLabel; - public static String ObjectTypeConverterComposite_conversionValuesGroupTitle; - - public static String ConversionValueDialog_addConversionValue; - public static String ConversionValueDialog_editConversionValue; - public static String ConversionValueDialog_addConversionValueDescriptionTitle; - public static String ConversionValueDialog_editConversionValueDescriptionTitle; - public static String ConversionValueDialog_addConversionValueDescription; - public static String ConversionValueDialog_editConversionValueDescription; - - public static String ConversionValueDialog_dataValue; - public static String ConversionValueDialog_objectValue; - public static String ConversionValueStateObject_dataValueMustBeSpecified; - public static String ConversionValueStateObject_objectValueMustBeSpecified; - public static String ConversionValueStateObject_dataValueAlreadyExists; - - public static String PrivateOwnedComposite_privateOwnedLabel; - - public static String ReadOnlyComposite_readOnlyLabel; - public static String ReadOnlyComposite_readOnlyWithDefault; - - public static String TypeConverterComposite_dataTypeLabel; - public static String TypeConverterComposite_objectTypeLabel; - - public static String DefaultOneToOneMappingUiProvider_label; - public static String DefaultVariableOneToOneMappingUiProvider_label; - public static String DefaultOneToManyMappingUiProvider_label; - public static String DefaultOneToOneMappingUiProvider_linkLabel; - public static String DefaultVariableOneToOneMappingUiProvider_linkLabel; - public static String DefaultOneToManyMappingUiProvider_linkLabel; - - public static String ConvertersComposite_Label; - public static String EclipseLinkConverterDialog_name; - public static String EclipseLinkConverterDialog_converterType; - public static String EclipseLinkConverterDialog_addConverter; - public static String EclipseLinkConverterDialog_addConverterDescriptionTitle; - public static String EclipseLinkConverterDialog_addConverterDescription; - public static String EclipseLinkConverterStateObject_nameMustBeSpecified; - public static String EclipseLinkConverterStateObject_typeMustBeSpecified; - - static { - NLS.initializeMessages("eclipselink_ui_mappings", EclipseLinkUiMappingsMessages.class); - } - - private EclipseLinkUiMappingsMessages() { - throw new UnsupportedOperationException(); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java deleted file mode 100644 index 3d3bcf9793..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java +++ /dev/null @@ -1,113 +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.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - - -/** - * This composite simply shows a tri-state check box for the Always Refresh option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class AlwaysRefreshComposite extends FormPane<Caching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public AlwaysRefreshComposite(FormPane<? extends Caching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildAlwaysRefreshHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_ALWAYS_REFRESH_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedAlwaysRefresh(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedAlwaysRefresh(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildAlwaysRefreshStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildAlwaysRefreshHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - - Boolean defaultValue = getSubject().isDefaultAlwaysRefresh(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - addTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel, - buildAlwaysRefreshHolder(), - buildAlwaysRefreshStringHolder(), - EclipseLinkHelpContextIds.CACHING_ALWAYS_REFRESH - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java deleted file mode 100644 index 32e48c6646..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicCollectionMappingComposite.java +++ /dev/null @@ -1,45 +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.eclipselink.core.context.BasicCollectionMapping; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * - * @version 2.1 - * @since 2.1 - */ -public class BasicCollectionMappingComposite extends FormPane<BasicCollectionMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public BasicCollectionMappingComposite(PropertyValueModel<? extends BasicCollectionMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java deleted file mode 100644 index 0003404b33..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/BasicMapMappingComposite.java +++ /dev/null @@ -1,45 +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.eclipselink.core.context.BasicMapMapping; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * - * @version 2.1 - * @since 2.1 - */ -public class BasicMapMappingComposite extends FormPane<BasicMapMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public BasicMapMappingComposite(PropertyValueModel<? extends BasicMapMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java deleted file mode 100644 index b5217f9829..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheCoordinationTypeComposite.java +++ /dev/null @@ -1,106 +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 java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.CacheCoordinationType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | ----------------------------------------------------- | - * | Coordination Type: | |v| | - * | ----------------------------------------------------- | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheCoordinationTypeComposite extends FormPane<Caching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheCoordinationTypeComposite(FormPane<? extends Caching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<Caching, CacheCoordinationType> addCacheCoordinationTypeCombo(Composite container) { - - return new EnumFormComboViewer<Caching, CacheCoordinationType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Caching.DEFAULT_COORDINATION_TYPE_PROPERTY); - propertyNames.add(Caching.SPECIFIED_COORDINATION_TYPE_PROPERTY); - } - - @Override - protected CacheCoordinationType[] getChoices() { - return CacheCoordinationType.values(); - } - - @Override - protected CacheCoordinationType getDefaultValue() { - return getSubject().getDefaultCoordinationType(); - } - - @Override - protected String displayString(CacheCoordinationType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheCoordinationTypeComposite.this, - value - ); - } - - @Override - protected CacheCoordinationType getValue() { - return getSubject().getSpecifiedCoordinationType(); - } - - @Override - protected void setValue(CacheCoordinationType value) { - getSubject().setSpecifiedCoordinationType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheCoordinationTypeComposite_label, - addCacheCoordinationTypeCombo(container), - EclipseLinkHelpContextIds.CACHING_CACHE_COORDINATION_TYPE - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java deleted file mode 100644 index ca46466e47..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheSizeComposite.java +++ /dev/null @@ -1,176 +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.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Spinner; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | --------------- | - * | Size: | I |I| Default (XXX) | - * | --------------- | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheSizeComposite extends FormPane<Caching> { - - /** - * Creates a new <code>CacheSizeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheSizeComposite(FormPane<? extends Caching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - // Size widgets - Spinner sizeSpinner = addLabeledSpinner( - container, - EclipseLinkUiMappingsMessages.CacheSizeComposite_size, - buildSizeHolder(), - -1, - -1, - Integer.MAX_VALUE, - addDefaultSizeLabel(container), - null//TODO JpaHelpContextIds.MAPPING_COLUMN_LENGTH - ); - - updateGridData(container, sizeSpinner); - } - - private WritablePropertyValueModel<Integer> buildSizeHolder() { - return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.SPECIFIED_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return subject.getSpecifiedSize(); - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setSpecifiedSize(value); - } - }; - } - - private WritablePropertyValueModel<Integer> buildDefaultSizeHolder() { - return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.DEFAULT_SIZE_PROPERTY) { - @Override - protected Integer buildValue_() { - return subject.getDefaultSize(); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Integer.MIN_VALUE, newValue); - } - } - }; - } - - private Control addDefaultSizeLabel(Composite container) { - - Label label = addLabel( - container, - JptUiMappingsMessages.DefaultEmpty - ); - - new LabeledControlUpdater( - new LabeledLabel(label), - buildDefaultSizeLabelHolder() - ); - - return label; - } - - private PropertyValueModel<String> buildDefaultSizeLabelHolder() { - - return new TransformationPropertyValueModel<Integer, String>(buildDefaultSizeHolder()) { - - @Override - protected String transform(Integer value) { - - Integer defaultValue = (getSubject() != null) ? getSubject().getDefaultSize() : - Caching.DEFAULT_SIZE; - - return NLS.bind( - JptUiMappingsMessages.DefaultWithOneParam, - defaultValue - ); - } - }; - } - - /** - * Changes the layout of the given container by changing which widget will - * grab the excess of horizontal space. By default, the center control grabs - * the excess space, we change it to be the right control. - * - * @param container The container containing the controls needing their - * <code>GridData</code> to be modified from the default values - * @param spinner The spinner that got created - */ - private void updateGridData(Composite container, Spinner spinner) { - - // It is possible the spinner's parent is not the container of the - // label, spinner and right control (a pane is sometimes required for - // painting the spinner's border) - Composite paneContainer = spinner.getParent(); - - while (container != paneContainer.getParent()) { - paneContainer = paneContainer.getParent(); - } - - Control[] controls = paneContainer.getChildren(); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.BEGINNING; - controls[1].setLayoutData(gridData); - - controls[2].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - removeAlignRight(controls[2]); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java deleted file mode 100644 index d6981e0cfe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CacheTypeComposite.java +++ /dev/null @@ -1,106 +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 java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.CacheType; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ---------------------------------------------------------------------------- - * | ------------------------------------------------------------------ | - * | Type: | |v| | - * | ------------------------------------------------------------------ | - * ----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CacheTypeComposite extends FormPane<Caching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheTypeComposite(FormPane<? extends Caching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<Caching, CacheType> addCacheTypeCombo(Composite container) { - - return new EnumFormComboViewer<Caching, CacheType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(Caching.DEFAULT_TYPE_PROPERTY); - propertyNames.add(Caching.SPECIFIED_TYPE_PROPERTY); - } - - @Override - protected CacheType[] getChoices() { - return CacheType.values(); - } - - @Override - protected CacheType getDefaultValue() { - return getSubject().getDefaultType(); - } - - @Override - protected String displayString(CacheType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheTypeComposite.this, - value - ); - } - - @Override - protected CacheType getValue() { - return getSubject().getSpecifiedType(); - } - - @Override - protected void setValue(CacheType value) { - getSubject().setSpecifiedType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheTypeComposite_label, - addCacheTypeCombo(container), - EclipseLinkHelpContextIds.CACHING_CACHE_TYPE - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java deleted file mode 100644 index 7c64a82fa2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java +++ /dev/null @@ -1,178 +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 java.util.ArrayList; -import java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.AlwaysRefreshComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CacheCoordinationTypeComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CacheSizeComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.CacheTypeComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.DisableHitsComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.ExpiryComposite; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.details.RefreshOnlyIfNewerComposite; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -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.SimplePropertyValueModel; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This pane shows the caching options. - * <p> - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | x Shared | - * | CacheTypeComposite | - * | CacheSizeComposite | - * | > Advanced | - * | ExpiryComposite | - * | AlwaysRefreshComposite | - * | RefreshOnlyIfNewerComposite | - * | DisableHitsComposite | - * | CacheCoordinationComposite | - * | ExistenceTypeComposite | - * -----------------------------------------------------------------------------</pre> - * - * @see Entity - * @see EclipseLinkCaching - * @see EclipseLinkJavaEntityComposite - The parent container - * @see CacheTypeComposite - * @see CacheSizeComposite - * @see AlwaysRefreshComposite - * @see RefreshOnlyIfNewerComposite - * @see DisableHitsComposite - * - * @version 2.1 - * @since 2.1 - */ -public abstract class CachingComposite<T extends Caching> extends FormPane<T> -{ - - protected CachingComposite(FormPane<?> parentPane, - PropertyValueModel<T> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - - //Shared Check box, uncheck this and the rest of the panel is disabled - addTriStateCheckBoxWithDefault( - addSubPane(container, 8), - EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel, - buildSharedHolder(), - buildSharedStringHolder(), - EclipseLinkHelpContextIds.CACHING_SHARED - ); - - Composite subPane = addSubPane(container, 0, 16); - - Collection<Pane<?>> panes = new ArrayList<Pane<?>>(); - - panes.add(new CacheTypeComposite(this, subPane)); - panes.add(new CacheSizeComposite(this, subPane)); - - // Advanced sub-pane - Composite advancedSection = addCollapsableSubSection( - subPane, - EclipseLinkUiMappingsMessages.CachingComposite_advanced, - new SimplePropertyValueModel<Boolean>(Boolean.FALSE) - ); - - initializeAdvancedPane(addSubPane(advancedSection, 0, 16), panes); - - new PaneEnabler(buildSharedCacheEnabler(), panes); - - initializeExistenceCheckingComposite(addSubPane(container, 8)); - } - - protected void initializeAdvancedPane(Composite container, Collection<Pane<?>> panes) { - panes.add(new ExpiryComposite(this, container)); - panes.add(new AlwaysRefreshComposite(this, container)); - panes.add(new RefreshOnlyIfNewerComposite(this, container)); - panes.add(new DisableHitsComposite(this, container)); - panes.add(new CacheCoordinationTypeComposite(this, container)); - } - - protected abstract void initializeExistenceCheckingComposite(Composite parent); - - private PropertyValueModel<Boolean> buildSharedCacheEnabler() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isShared()); - } - }; - } - - private WritablePropertyValueModel<Boolean> buildSharedHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedShared(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedShared(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildSharedStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildSharedHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - boolean defaultValue = getSubject().isDefaultShared(); - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.CachingComposite_sharedLabelDefault, - defaultStringValue - ); - } - - return EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel; - } - }; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java deleted file mode 100644 index 70457d06d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ChangeTrackingComposite.java +++ /dev/null @@ -1,108 +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 java.util.Collection; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.ChangeTrackingType; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ------------------------------------------------------------------------- - * | ---------------------------------------------- | - * | Change Tracking : | |v| | - * | ---------------------------------------------- | - * -------------------------------------------------------------------------</pre> - * - * @see ChangeTracking - * - * @version 2.1 - * @since 2.1 - */ -public class ChangeTrackingComposite extends FormPane<ChangeTracking> { - - /** - * Creates a new <code>ChangeTrackingComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ChangeTrackingComposite(FormPane<?> parentPane, - PropertyValueModel<? extends ChangeTracking> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledComposite( - container, - addLabel( - container, - EclipseLinkUiMappingsMessages.ChangeTrackingComposite_label), - addChangeTrackingTypeCombo(container).getControl(), - null - ); - } - - private EnumFormComboViewer<ChangeTracking, ChangeTrackingType> addChangeTrackingTypeCombo(Composite container) { - - return new EnumFormComboViewer<ChangeTracking, ChangeTrackingType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(ChangeTracking.DEFAULT_TYPE_PROPERTY); - propertyNames.add(ChangeTracking.SPECIFIED_TYPE_PROPERTY); - } - - @Override - protected ChangeTrackingType[] getChoices() { - return ChangeTrackingType.values(); - } - - @Override - protected ChangeTrackingType getDefaultValue() { - return getSubject().getDefaultType(); - } - - @Override - protected String displayString(ChangeTrackingType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - ChangeTrackingComposite.this, - value - ); - } - - @Override - protected ChangeTrackingType getValue() { - return getSubject().getSpecifiedType(); - } - - @Override - protected void setValue(ChangeTrackingType value) { - getSubject().setSpecifiedType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java deleted file mode 100644 index e884da8fe8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueDialog.java +++ /dev/null @@ -1,210 +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 java.util.Set; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.DialogPane; -import org.eclipse.jpt.ui.internal.widgets.ValidatingDialog; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Clients can use this dialog to prompt the user for SecondaryTable settings. - * Use the following once the dialog is closed: - * @see #getSelectedTable() - * @see #getSelectedCatalog() - * @see #getSelectedSchema() - * @version 2.1 - * @since 2.1 - */ -public class ConversionValueDialog extends ValidatingDialog<ConversionValueStateObject> { - - /** - * when creating a new EclipseLinkConversionValue, 'conversionValue' will be null - */ - private final ConversionValue conversionValue; - - private ObjectTypeConverter objectTypeConverter; - - // ********** constructors ********** - - /** - * Use this constructor to create a new conversion value - */ - public ConversionValueDialog(Shell parent, ObjectTypeConverter objectTypeConverter) { - this(parent,objectTypeConverter, null); - } - - /** - * Use this constructor to edit an existing conversion value - */ - public ConversionValueDialog(Shell parent, ObjectTypeConverter objectTypeConverter, ConversionValue conversionValue) { - super(parent); - this.objectTypeConverter = objectTypeConverter; - this.conversionValue = conversionValue; - } - - @Override - protected ConversionValueStateObject buildStateObject() { - String dataValue = null; - String objectValue = null; - Set<String> dataValues = CollectionTools.set(this.objectTypeConverter.dataValues()); - if (isEditDialog()) { - dataValue = this.conversionValue.getDataValue(); - objectValue = this.conversionValue.getObjectValue(); - //remove *this* dataValue, don't want a duplicate data value error - dataValues.remove(dataValue); - } - return new ConversionValueStateObject( - dataValue, - objectValue, - dataValues); - } - - // ********** open ********** - - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(this.getTitle()); - } - - @Override - protected String getTitle() { - return (this.isAddDialog()) ? - EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValue - : - EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValue; - } - - @Override - protected String getDescriptionTitle() { - return (this.isAddDialog()) ? - EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValueDescriptionTitle - : - EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValueDescriptionTitle; - } - - @Override - protected String getDescription() { - return (this.isAddDialog()) ? - EclipseLinkUiMappingsMessages.ConversionValueDialog_addConversionValueDescription - : - EclipseLinkUiMappingsMessages.ConversionValueDialog_editConversionValueDescription; - } - - @Override - protected DialogPane<ConversionValueStateObject> buildLayout(Composite container) { - return new ConversionValueDialogPane(container); - } - - @Override - public void create() { - super.create(); - - ConversionValueDialogPane pane = (ConversionValueDialogPane) getPane(); - pane.selectAll(); - - getButton(OK).setEnabled(false); - } - - - // ********** convenience methods ********** - - protected boolean isAddDialog() { - return this.conversionValue == null; - } - - protected boolean isEditDialog() { - return ! this.isAddDialog(); - } - - - // ********** public API ********** - - /** - * Return the data value set in the text widget. - */ - public String getDataValue() { - return getSubject().getDataValue(); - } - - /** - * Return the object value set in the text widget. - */ - public String getObjectValue() { - return getSubject().getObjectValue(); - } - - private class ConversionValueDialogPane extends DialogPane<ConversionValueStateObject> { - - private Text dataValueText; - private Text objectValueText; - - ConversionValueDialogPane(Composite parent) { - super(ConversionValueDialog.this.getSubjectHolder(), parent); - } - - @Override - protected void initializeLayout(Composite container) { - this.dataValueText = addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConversionValueDialog_dataValue, - buildDataValueHolder() - ); - - this.objectValueText = addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConversionValueDialog_objectValue, - buildObjectValueHolder() - ); - } - - private WritablePropertyValueModel<String> buildDataValueHolder() { - return new PropertyAspectAdapter<ConversionValueStateObject, String>(getSubjectHolder(), ConversionValueStateObject.DATA_VALUE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDataValue(); - } - - @Override - protected void setValue_(String value) { - this.subject.setDataValue(value); - } - }; - } - - private WritablePropertyValueModel<String> buildObjectValueHolder() { - return new PropertyAspectAdapter<ConversionValueStateObject, String>(getSubjectHolder(), ConversionValueStateObject.OBJECT_VALUE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getObjectValue(); - } - - @Override - protected void setValue_(String value) { - this.subject.setObjectValue(value); - } - }; - } - - void selectAll() { - this.dataValueText.selectAll(); - this.objectValueText.selectAll(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java deleted file mode 100644 index 3bbcf48174..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConversionValueStateObject.java +++ /dev/null @@ -1,138 +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 java.util.Collection; -import java.util.List; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.internal.node.AbstractNode; -import org.eclipse.jpt.utility.internal.node.Node; -import org.eclipse.jpt.utility.internal.node.Problem; - -/** - * This is the state object used by the <code>NewNameDialog</code>, which stores - * the current name and validates it when it is modified. - * - * @see NewNameDialog - * - * @version 2.1 - * @since 2.1 - */ -@SuppressWarnings("nls") -final class ConversionValueStateObject extends AbstractNode -{ - /** - * The initial dataValue or <code>null</code> - */ - private String dataValue; - - /** - * The collection of data values that can't be used or an empty collection - */ - private Collection<String> dataValues; - - /** - * The initial objectValue or <code>null</code> - */ - private String objectValue; - - /** - * The <code>Validator</code> used to validate this state object. - */ - private Validator validator; - - /** - * Notifies a change in the data value property. - */ - static final String DATA_VALUE_PROPERTY = "dataValue"; - - /** - * Notifies a change in the object value property. - */ - static final String OBJECT_VALUE_PROPERTY = "objectValue"; - - /** - * Creates a new <code>NewNameStateObject</code>. - * - * @param name The initial input or <code>null</code> if no initial value can - * be specified - * @param names The collection of names that can't be used or an empty - * collection if none are available - */ - ConversionValueStateObject(String dataValue, String objectValue, Collection<String> dataValues) { - super(null); - - this.dataValue = dataValue; - this.objectValue = objectValue; - this.dataValues = dataValues; - } - - private void addDataValueProblemsTo(List<Problem> currentProblems) { - if (StringTools.stringIsEmpty(this.dataValue)) { - currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_dataValueMustBeSpecified)); - } - else if (this.dataValues.contains(this.dataValue)) { - currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_dataValueAlreadyExists)); - } - } - - private void addObjectValueProblemsTo(List<Problem> currentProblems) { - if (StringTools.stringIsEmpty(this.objectValue)) { - currentProblems.add(buildProblem(EclipseLinkUiMappingsMessages.ConversionValueStateObject_objectValueMustBeSpecified)); - } - } - - @Override - protected void addProblemsTo(List<Problem> currentProblems) { - super.addProblemsTo(currentProblems); - addDataValueProblemsTo(currentProblems); - addObjectValueProblemsTo(currentProblems); - } - - @Override - protected void checkParent(Node parentNode) { - //not parent - } - - public String displayString() { - return null; - } - - String getDataValue() { - return this.dataValue; - } - - String getObjectValue() { - return this.objectValue; - } - - public void setDataValue(String dataValue) { - String oldDataValue = this.dataValue; - this.dataValue = dataValue; - firePropertyChanged(DATA_VALUE_PROPERTY, oldDataValue, dataValue); - } - - public void setObjectValue(String objectValue) { - String oldObjectValue = this.objectValue; - this.objectValue = objectValue; - firePropertyChanged(OBJECT_VALUE_PROPERTY, oldObjectValue, objectValue); - } - - @Override - public void setValidator(Validator validator) { - this.validator = validator; - } - - @Override - public Validator getValidator() { - return this.validator; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java deleted file mode 100644 index 1a3ea33175..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ConvertComposite.java +++ /dev/null @@ -1,361 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import java.util.ArrayList; -import java.util.ListIterator; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.util.SWTUtil; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.CollectionTools; -import org.eclipse.jpt.utility.internal.StringConverter; -import org.eclipse.jpt.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | -------------------------------------------------------------- | - * | Enum Type: | |v| | - * | -------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkConvert - * @see EclipseLinkBasicMappingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class ConvertComposite extends FormPane<Convert> -{ - - /** - * A key used to represent the default value, this is required to convert - * the selected item from a combo to <code>null</code>. This key is most - * likely never typed the user and it will help to convert the value to - * <code>null</code> when it's time to set the new selected value into the - * model. - */ - protected static String DEFAULT_KEY = "?!#!?#?#?default?#?!#?!#?"; //$NON-NLS-1$ - - - /** - * Creates a new <code>EnumTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ConvertComposite(PropertyValueModel<? extends Convert> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - CCombo combo = addLabeledEditableCCombo( - container, - EclipseLinkUiMappingsMessages.ConvertComposite_converterNameLabel, - buildConvertNameListHolder(), - buildConvertNameHolder(), - buildNameConverter(), - null - ); - SWTUtil.attachDefaultValueHandler(combo); - - Composite subSection = addCollapsableSubSection( - container, - EclipseLinkUiMappingsMessages.ConvertComposite_defineConverterSection, - new SimplePropertyValueModel<Boolean>(Boolean.FALSE)); - - // No Converter - addRadioButton( - subSection, - EclipseLinkUiMappingsMessages.ConvertComposite_default, - buildNoConverterHolder(), - null); - PropertyValueModel<EclipseLinkConverter> converterHolder = buildConverterHolder(); - // CustomConverter - addRadioButton( - subSection, - EclipseLinkUiMappingsMessages.ConvertComposite_custom, - buildConverterHolder(EclipseLinkConverter.CUSTOM_CONVERTER), - null); - CustomConverterComposite converterComposite = new CustomConverterComposite(buildCustomConverterHolder(converterHolder), subSection, getWidgetFactory()); - GridData gridData = (GridData) converterComposite.getControl().getLayoutData(); - gridData.horizontalIndent = 20; - registerSubPane(converterComposite); - - // Type Converter - addRadioButton( - subSection, - EclipseLinkUiMappingsMessages.ConvertComposite_type, - buildConverterHolder(EclipseLinkConverter.TYPE_CONVERTER), - null); - TypeConverterComposite typeConverterComposite = new TypeConverterComposite(buildTypeConverterHolder(converterHolder), subSection, getWidgetFactory()); - gridData = (GridData) typeConverterComposite.getControl().getLayoutData(); - gridData.horizontalIndent = 20; - registerSubPane(typeConverterComposite); - - // Object Type Converter - addRadioButton( - subSection, - EclipseLinkUiMappingsMessages.ConvertComposite_objectType, - buildConverterHolder(EclipseLinkConverter.OBJECT_TYPE_CONVERTER), - null); - ObjectTypeConverterComposite objectTypeConverterComposite = new ObjectTypeConverterComposite(buildObjectTypeConverterHolder(converterHolder), subSection, getWidgetFactory()); - gridData = (GridData) objectTypeConverterComposite.getControl().getLayoutData(); - gridData.horizontalIndent = 20; - registerSubPane(objectTypeConverterComposite); - - // Struct Converter - addRadioButton( - subSection, - EclipseLinkUiMappingsMessages.ConvertComposite_struct, - buildConverterHolder(EclipseLinkConverter.STRUCT_CONVERTER), - null); - StructConverterComposite structConverterComposite = new StructConverterComposite(buildStructConverterHolder(converterHolder), subSection, getWidgetFactory()); - gridData = (GridData) structConverterComposite.getControl().getLayoutData(); - gridData.horizontalIndent = 20; - registerSubPane(structConverterComposite); - - new PaneEnabler(buildBooleanHolder(), this); - } - - protected final WritablePropertyValueModel<String> buildConvertNameHolder() { - return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.SPECIFIED_CONVERTER_NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getSpecifiedConverterName(); - } - - @Override - protected void setValue_(String value) { - // Convert the default value or an empty string to null - if ((value != null) && - ((value.length() == 0) || value.startsWith(DEFAULT_KEY))) { - - value = null; - } - this.subject.setSpecifiedConverterName(value); - } - }; - } - private ListValueModel<String> buildConvertNameListHolder() { - java.util.List<ListValueModel<String>> list = new ArrayList<ListValueModel<String>>(); - list.add(buildDefaultNameListHolder()); - list.add(buildReservedConverterNameListHolder()); - list.add(buildConverterNameListHolder()); - return new CompositeListValueModel<ListValueModel<String>, String>(list); - } - - protected ListValueModel<String> buildDefaultNameListHolder() { - return new PropertyListValueModelAdapter<String>( - buildDefaultNameHolder() - ); - } - - private WritablePropertyValueModel<String> buildDefaultNameHolder() { - return new PropertyAspectAdapter<Convert, String>(getSubjectHolder(), Convert.DEFAULT_CONVERTER_NAME_PROPERTY) { - @Override - protected String buildValue_() { - String name = this.subject.getDefaultConverterName(); - - if (name == null) { - name = DEFAULT_KEY; - } - else { - name = DEFAULT_KEY + name; - } - - return name; - } - }; - } - - private StringConverter<String> buildNameConverter() { - return new StringConverter<String>() { - public String convertToString(String value) { - - if (getSubject() == null) { - return value; - } - - if (value == null) { - value = getSubject().getDefaultConverterName(); - - if (value != null) { - value = DEFAULT_KEY + value; - } - else { - value = DEFAULT_KEY; - } - } - - if (value.startsWith(DEFAULT_KEY)) { - String defaultName = value.substring(DEFAULT_KEY.length()); - - if (defaultName.length() > 0) { - value = NLS.bind( - JptUiMappingsMessages.DefaultWithOneParam, - defaultName - ); - } - else { - value = JptUiMappingsMessages.DefaultEmpty; - } - } - - return value; - } - }; - } - - protected ListValueModel<String> buildReservedConverterNameListHolder() { - return new StaticListValueModel<String>(Convert.RESERVED_CONVERTER_NAMES); - } - - protected ListValueModel<String> buildConverterNameListHolder() { - return new ListAspectAdapter<EclipseLinkPersistenceUnit, String>( - buildPersistenceUnitHolder(), - EclipseLinkPersistenceUnit.CONVERTERS_LIST)//TODO need EclipseLinkPersistenceUnit interface - { - @Override - protected ListIterator<String> listIterator_() { - return CollectionTools.listIterator(CollectionTools.sort(this.subject.uniqueConverterNames())); - } - }; - } - - protected PropertyValueModel<EclipseLinkPersistenceUnit> buildPersistenceUnitHolder() { - return new PropertyAspectAdapter<Convert, EclipseLinkPersistenceUnit>(getSubjectHolder()) { - @Override - protected EclipseLinkPersistenceUnit buildValue_() { - return (EclipseLinkPersistenceUnit) getSubject().getPersistenceUnit(); - } - }; - } - - private WritablePropertyValueModel<Boolean> buildNoConverterHolder() { - return new PropertyAspectAdapter<Convert, Boolean>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getConverter() == null); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setConverter(EclipseLinkConverter.NO_CONVERTER); - } - } - }; - } - - private WritablePropertyValueModel<Boolean> buildConverterHolder(final String converterType) { - return new PropertyAspectAdapter<Convert, Boolean>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) { - @Override - protected Boolean buildValue_() { - EclipseLinkConverter converter = this.subject.getConverter(); - if (converter == null) { - return Boolean.FALSE; - } - return Boolean.valueOf(converter.getType() == converterType); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setConverter(converterType); - } - } - }; - } - - private PropertyValueModel<EclipseLinkConverter> buildConverterHolder() { - return new PropertyAspectAdapter<Convert, EclipseLinkConverter>(getSubjectHolder(), Convert.CONVERTER_PROPERTY) { - @Override - protected EclipseLinkConverter buildValue_() { - return this.subject.getConverter(); - } - }; - } - - private PropertyValueModel<CustomConverter> buildCustomConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) { - return new TransformationPropertyValueModel<EclipseLinkConverter, CustomConverter>(converterHolder) { - @Override - protected CustomConverter transform_(EclipseLinkConverter converter) { - return (converter != null && converter.getType() == EclipseLinkConverter.CUSTOM_CONVERTER) ? (CustomConverter) converter : null; - } - }; - } - - private PropertyValueModel<TypeConverter> buildTypeConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) { - return new TransformationPropertyValueModel<EclipseLinkConverter, TypeConverter>(converterHolder) { - @Override - protected TypeConverter transform_(EclipseLinkConverter converter) { - return (converter != null && converter.getType() == EclipseLinkConverter.TYPE_CONVERTER) ? (TypeConverter) converter : null; - } - }; - } - - private PropertyValueModel<ObjectTypeConverter> buildObjectTypeConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) { - return new TransformationPropertyValueModel<EclipseLinkConverter, ObjectTypeConverter>(converterHolder) { - @Override - protected ObjectTypeConverter transform_(EclipseLinkConverter converter) { - return (converter != null && converter.getType() == EclipseLinkConverter.OBJECT_TYPE_CONVERTER) ? (ObjectTypeConverter) converter : null; - } - }; - } - - private PropertyValueModel<StructConverter> buildStructConverterHolder(PropertyValueModel<EclipseLinkConverter> converterHolder) { - return new TransformationPropertyValueModel<EclipseLinkConverter, StructConverter>(converterHolder) { - @Override - protected StructConverter transform_(EclipseLinkConverter converter) { - return (converter != null && converter.getType() == EclipseLinkConverter.STRUCT_CONVERTER) ? (StructConverter) converter : null; - } - }; - } - - protected PropertyValueModel<Boolean> buildBooleanHolder() { - return new TransformationPropertyValueModel<Convert, Boolean>(getSubjectHolder()) { - @Override - protected Boolean transform(Convert value) { - if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) { - return Boolean.FALSE; - } - return Boolean.valueOf(value != null); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java deleted file mode 100644 index 18696375b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomConverterComposite.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.eclipselink.core.context.CustomConverter; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | -------------------------------------------------------------- | - * | Name: | || - * | -------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkConverter - * @see ConvertComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class CustomConverterComposite extends FormPane<CustomConverter> -{ - - /** - * Creates a new <code>ConverterComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CustomConverterComposite(PropertyValueModel<? extends CustomConverter> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel, - buildNameTextHolder()); - - addClassChooser(container); - - new PaneEnabler(buildBooleanHolder(), this); - } - - protected WritablePropertyValueModel<String> buildNameTextHolder() { - return new PropertyAspectAdapter<CustomConverter, String>( - getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - this.subject.setName(value); - } - }; - } - - - private ClassChooserPane<CustomConverter> addClassChooser(Composite container) { - - return new ClassChooserPane<CustomConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<CustomConverter, String>(getSubjectHolder(), CustomConverter.CONVERTER_CLASS_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getConverterClass(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setConverterClass(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getConverterClass(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.ConverterComposite_classLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setConverterClass(className); - } - - @Override - protected String getSuperInterfaceName() { - return CustomConverter.ECLIPSELINK_CONVERTER_CLASS_NAME; - } - }; - } - - - protected PropertyValueModel<Boolean> buildBooleanHolder() { - return new TransformationPropertyValueModel<CustomConverter, Boolean>(getSubjectHolder()) { - @Override - protected Boolean transform(CustomConverter value) { -// if (getSubject() != null && getSubject().getParent().getPersistentAttribute().isVirtual()) { -// return Boolean.FALSE; -// } - return Boolean.valueOf(value != null); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java deleted file mode 100644 index d9828575c8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CustomizerComposite.java +++ /dev/null @@ -1,100 +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.JpaProject; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * - * @see Customizer - * - * @version 2.1 - * @since 2.1 - */ -public class CustomizerComposite extends FormPane<Customizer> -{ - /** - * Creates a new <code>CustomizerComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CustomizerComposite(FormPane<?> parentPane, - PropertyValueModel<? extends Customizer> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - addCustomizerClassChooser(container); - } - - private ClassChooserPane<Customizer> addCustomizerClassChooser(Composite container) { - - return new ClassChooserPane<Customizer>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<Customizer, String>(getSubjectHolder(), Customizer.SPECIFIED_CUSTOMIZER_CLASS_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getSpecifiedCustomizerClass(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setSpecifiedCustomizerClass(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getSpecifiedCustomizerClass(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.CustomizerComposite_classLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setSpecifiedCustomizerClass(className); - } - - @Override - protected String getSuperInterfaceName() { - return Customizer.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER_CLASS_NAME; - } - }; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java deleted file mode 100644 index ba3cef5ba1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java +++ /dev/null @@ -1,112 +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.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows a tri-state check box for the Disable Hits option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class DisableHitsComposite extends FormPane<Caching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public DisableHitsComposite(FormPane<? extends Caching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildDisableHitsHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_DISABLE_HITS_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedDisableHits(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedDisableHits(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildDisableHitsStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildDisableHitsHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - - Boolean defaultValue = getSubject().isDefaultDisableHits(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - addTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel, - buildDisableHitsHolder(), - buildDisableHitsStringHolder(), - EclipseLinkHelpContextIds.CACHING_DISABLE_HITS - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java deleted file mode 100644 index 4bf9f9f487..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicCollectionMappingUiProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicCollectionMapping; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.internal.JptUiIcons; -import org.eclipse.swt.graphics.Image; - -public abstract class EclipseLinkBasicCollectionMappingUiProvider<T extends BasicCollectionMapping> - implements AttributeMappingUiProvider<T> -{ - - protected EclipseLinkBasicCollectionMappingUiProvider() {} - - public Image getImage() { - return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT); - } - - public String getLabel() { - return EclipseLinkUiMappingsMessages.BasicCollectionMappingUiProvider_label; - } - - public String getLinkLabel() { - return EclipseLinkUiMappingsMessages.BasicCollectionMappingUiProvider_linkLabel; - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java deleted file mode 100644 index e0890f7a03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMapMappingUiProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.BasicMapMapping; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.internal.JptUiIcons; -import org.eclipse.swt.graphics.Image; - -public abstract class EclipseLinkBasicMapMappingUiProvider<T extends BasicMapMapping> - implements AttributeMappingUiProvider<T> -{ - - protected EclipseLinkBasicMapMappingUiProvider() { - super(); - } - - public Image getImage() { - return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT); - } - - public String getLabel() { - return EclipseLinkUiMappingsMessages.BasicMapMappingUiProvider_label; - } - - public String getLinkLabel() { - return EclipseLinkUiMappingsMessages.BasicMapMappingUiProvider_linkLabel; - } - - public String getKey() { - return EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java deleted file mode 100644 index f5ccc6519c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkBasicMappingComposite.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.BasicMapping; -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.EnumeratedConverter; -import org.eclipse.jpt.core.context.TemporalConverter; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping; -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.EnumTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite; -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 | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | FetchTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | TemporalTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | EnumTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | OptionalComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | MutableComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | 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.1 - * @since 2.1 - */ -public class EclipseLinkBasicMappingComposite extends FormPane<BasicMapping> - implements JpaComposite -{ - /** - * 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 EclipseLinkBasicMappingComposite(PropertyValueModel<? extends BasicMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeTypePane(container); - } - - protected void initializeGeneralPane(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - - new ColumnComposite(this, buildColumnHolder(), container); - - // Align the widgets under the ColumnComposite - container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - - new FetchTypeComposite(this, container); - new OptionalComposite(this, addSubPane(container, 4)); - - // Mutable widgets - new MutableComposite(this, buildMutableHolder(), container); - } - - protected void initializeTypePane(Composite container) { - - container = addCollapsableSection( - container, - JptUiMappingsMessages.TypeSection_type - ); - ((GridLayout) container.getLayout()).numColumns = 2; - - // No converter - Button noConverterButton = addRadioButton( - container, - JptUiMappingsMessages.TypeSection_default, - buildNoConverterHolder(), - null); - ((GridData) noConverterButton.getLayoutData()).horizontalSpan = 2; - - // Lob - Button lobButton = addRadioButton( - container, - JptUiMappingsMessages.TypeSection_lob, - buildConverterBooleanHolder(Converter.LOB_CONVERTER), - null); - ((GridData) lobButton.getLayoutData()).horizontalSpan = 2; - - PropertyValueModel<Converter> specifiedConverterHolder = buildSpecifiedConverterHolder(); - // Temporal - addRadioButton( - container, - JptUiMappingsMessages.TypeSection_temporal, - buildConverterBooleanHolder(Converter.TEMPORAL_CONVERTER), - null); - registerSubPane(new TemporalTypeComposite(buildTemporalConverterHolder(specifiedConverterHolder), container, getWidgetFactory())); - - - // Enumerated - addRadioButton( - container, - JptUiMappingsMessages.TypeSection_enumerated, - buildConverterBooleanHolder(Converter.ENUMERATED_CONVERTER), - null); - registerSubPane(new EnumTypeComposite(buildEnumeratedConverterHolder(specifiedConverterHolder), container, getWidgetFactory())); - - // EclipseLink Converter - Button elConverterButton = addRadioButton( - container, - EclipseLinkUiMappingsMessages.TypeSection_converted, - buildConverterBooleanHolder(Convert.ECLIPSE_LINK_CONVERTER), - 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 PropertyValueModel<Column> buildColumnHolder() { - return new TransformationPropertyValueModel<BasicMapping, Column>(getSubjectHolder()) { - @Override - protected Column transform_(BasicMapping value) { - return value.getColumn(); - } - }; - } - - protected PropertyValueModel<Mutable> buildMutableHolder() { - return new PropertyAspectAdapter<BasicMapping, Mutable>(getSubjectHolder()) { - @Override - protected Mutable buildValue_() { - return ((EclipseLinkBasicMapping) this.subject).getMutable(); - } - }; - } - - protected PropertyValueModel<Converter> buildSpecifiedConverterHolder() { - return new PropertyAspectAdapter<BasicMapping, 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<EnumeratedConverter> buildEnumeratedConverterHolder(PropertyValueModel<Converter> converterHolder) { - return new TransformationPropertyValueModel<Converter, EnumeratedConverter>(converterHolder) { - @Override - protected EnumeratedConverter transform_(Converter converter) { - return (converter != null && converter.getType() == Converter.ENUMERATED_CONVERTER) ? (EnumeratedConverter) converter : null; - } - }; - } - - 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> buildNoConverterHolder() { - return new PropertyAspectAdapter<BasicMapping, 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 WritablePropertyValueModel<Boolean> buildConverterBooleanHolder(final String converterType) { - return new PropertyAspectAdapter<BasicMapping, 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() == converterType); - } - - @Override - protected void setValue_(Boolean value) { - if (value.booleanValue()) { - this.subject.setSpecifiedConverter(converterType); - } - } - }; - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java deleted file mode 100644 index 95c7c879ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEmbeddableAdvancedComposite.java +++ /dev/null @@ -1,59 +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.Embeddable; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEmbeddable; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -public class EclipseLinkEmbeddableAdvancedComposite extends FormPane<Embeddable> { - - public EclipseLinkEmbeddableAdvancedComposite( - FormPane<? extends Embeddable> parentPane, - Composite parent) { - - super(parentPane, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - container = addCollapsableSection( - container, - EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced - ); - - new CustomizerComposite(this, buildCustomizerHolder(), container); - new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container); - } - - private PropertyValueModel<Customizer> buildCustomizerHolder() { - return new PropertyAspectAdapter<Embeddable, Customizer>(getSubjectHolder()) { - @Override - protected Customizer buildValue_() { - return ((EclipseLinkEmbeddable) this.subject).getCustomizer(); - } - }; - } - - private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() { - return new PropertyAspectAdapter<Embeddable, ChangeTracking>(getSubjectHolder()) { - @Override - protected ChangeTracking buildValue_() { - return ((EclipseLinkEmbeddable) this.subject).getChangeTracking(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java deleted file mode 100644 index da73465c0f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkEntityAdvancedComposite.java +++ /dev/null @@ -1,70 +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.Entity; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -public class EclipseLinkEntityAdvancedComposite extends FormPane<Entity> { - - public EclipseLinkEntityAdvancedComposite( - FormPane<? extends Entity> parentPane, - Composite parent) { - - super(parentPane, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - container = addCollapsableSection( - container, - EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced - ); - - new ReadOnlyComposite(this, buildReadOnlyHolder(), container); - new CustomizerComposite(this, buildCustomizerHolder(), container); - new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container); - } - - private PropertyValueModel<ReadOnly> buildReadOnlyHolder() { - return new PropertyAspectAdapter<Entity, ReadOnly>(getSubjectHolder()) { - @Override - protected ReadOnly buildValue_() { - return ((EclipseLinkEntity) this.subject).getReadOnly(); - } - }; - } - - private PropertyValueModel<Customizer> buildCustomizerHolder() { - return new PropertyAspectAdapter<Entity, Customizer>(getSubjectHolder()) { - @Override - protected Customizer buildValue_() { - return ((EclipseLinkEntity) this.subject).getCustomizer(); - } - }; - } - - private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() { - return new PropertyAspectAdapter<Entity, ChangeTracking>(getSubjectHolder()) { - @Override - protected ChangeTracking buildValue_() { - return ((EclipseLinkEntity) this.subject).getChangeTracking(); - } - }; - } -} 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 4cbc875e6e..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); - } - - protected 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 diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java deleted file mode 100644 index cbbcea373f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToManyMappingComposite.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.Cascade; -import org.eclipse.jpt.core.context.JoinTable; -import org.eclipse.jpt.core.context.ManyToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -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.CascadeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.JoinTableComposite; -import org.eclipse.jpt.ui.internal.mappings.details.MappedByComposite; -import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite; -import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | TargetEntityComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | FetchTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | CascadeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | OrderingComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | | - * | - Join Table ------------------------------------------------------------ | - * | | | | - * | | JoinTableComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see ManyToManyMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see CascadeComposite - * @see FetchTypeComposite - * @see JoinTableComposite - * @see OrderingComposite - * @see TargetEntityComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkManyToManyMappingComposite extends FormPane<ManyToManyMapping> - 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 - */ - public EclipseLinkManyToManyMappingComposite(PropertyValueModel<? extends ManyToManyMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeJoinTablePane(container); - } - - protected void initializeGeneralPane(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - - new TargetEntityComposite(this, addPane(container, groupBoxMargin)); - new FetchTypeComposite(this, addPane(container, groupBoxMargin)); - new JoinFetchComposite(this, buildJoinFetchableHolder(), addPane(container, groupBoxMargin)); - new MappedByComposite(this, addPane(container, groupBoxMargin)); - new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 5)); - new OrderingComposite(this, container); - } - - protected void initializeJoinTablePane(Composite container) { - - container = addCollapsableSection( - container, - JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable - ); - - new JoinTableComposite( - this, - buildJoinTableHolder(), - container - ); - } - - protected Composite addPane(Composite container, int groupBoxMargin) { - return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - } - - - protected PropertyValueModel<Cascade> buildCascadeHolder() { - return new TransformationPropertyValueModel<ManyToManyMapping, Cascade>(getSubjectHolder()) { - @Override - protected Cascade transform_(ManyToManyMapping value) { - return value.getCascade(); - } - }; - } - - protected PropertyValueModel<JoinTable> buildJoinTableHolder() { - return new TransformationPropertyValueModel<ManyToManyMapping, JoinTable>(getSubjectHolder()) { - @Override - protected JoinTable transform_(ManyToManyMapping value) { - return value.getJoinTable(); - } - }; - } - - protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() { - return new PropertyAspectAdapter<ManyToManyMapping, JoinFetch>(getSubjectHolder()) { - @Override - protected JoinFetch buildValue_() { - return ((EclipseLinkRelationshipMapping) this.subject).getJoinFetch(); - } - }; - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java deleted file mode 100644 index d27d918a37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkManyToOneMappingComposite.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.Cascade; -import org.eclipse.jpt.core.context.ManyToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnComposite; -import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite; -import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | TargetEntityComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | FetchTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | OptionalComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | CascadeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | JoinColumnComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see ManyToOneMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see CascadeComposite - * @see FetchTypeComposite - * @see JoinColumnComposite - * @see OptionalComposite - * @see TargetEntityComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkManyToOneMappingComposite extends FormPane<ManyToOneMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipseLinkManyToOneMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>ManyToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkManyToOneMappingComposite(PropertyValueModel<? extends ManyToOneMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - Composite subPane = addPane(container, groupBoxMargin); - - new TargetEntityComposite(this, subPane); - new FetchTypeComposite(this, subPane); - new JoinFetchComposite(this, buildJoinFetchableHolder(), subPane); - new OptionalComposite(this, addSubPane(subPane, 4)); - new CascadeComposite(this, buildCascadeHolder(), container); - new JoinColumnComposite(this, container); - } - - protected Composite addPane(Composite container, int groupBoxMargin) { - return addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - } - - protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() { - return new PropertyAspectAdapter<ManyToOneMapping, JoinFetch>(getSubjectHolder()) { - @Override - protected JoinFetch buildValue_() { - return ((EclipseLinkRelationshipMapping) this.subject).getJoinFetch(); - } - }; - } - - protected PropertyValueModel<Cascade> buildCascadeHolder() { - return new TransformationPropertyValueModel<ManyToOneMapping, Cascade>(getSubjectHolder()) { - @Override - protected Cascade transform_(ManyToOneMapping value) { - return value.getCascade(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java deleted file mode 100644 index 007b8f0844..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkMappedSuperclassAdvancedComposite.java +++ /dev/null @@ -1,70 +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.MappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.ChangeTracking; -import org.eclipse.jpt.eclipselink.core.context.Customizer; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMappedSuperclass; -import org.eclipse.jpt.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -public class EclipseLinkMappedSuperclassAdvancedComposite extends FormPane<MappedSuperclass> { - - public EclipseLinkMappedSuperclassAdvancedComposite( - FormPane<? extends MappedSuperclass> parentPane, - Composite parent) { - - super(parentPane, parent, false); - } - - @Override - protected void initializeLayout(Composite container) { - container = addCollapsableSection( - container, - EclipseLinkUiMappingsMessages.EclipseLinkTypeMappingComposite_advanced - ); - - new ReadOnlyComposite(this, buildReadOnlyHolder(), container); - new CustomizerComposite(this, buildCustomizerHolder(), container); - new ChangeTrackingComposite(this, buildChangeTrackingHolder(), container); - } - - private PropertyValueModel<ReadOnly> buildReadOnlyHolder() { - return new PropertyAspectAdapter<MappedSuperclass, ReadOnly>(getSubjectHolder()) { - @Override - protected ReadOnly buildValue_() { - return ((EclipseLinkMappedSuperclass) this.subject).getReadOnly(); - } - }; - } - - private PropertyValueModel<Customizer> buildCustomizerHolder() { - return new PropertyAspectAdapter<MappedSuperclass, Customizer>(getSubjectHolder()) { - @Override - protected Customizer buildValue_() { - return ((EclipseLinkMappedSuperclass) this.subject).getCustomizer(); - } - }; - } - - private PropertyValueModel<ChangeTracking> buildChangeTrackingHolder() { - return new PropertyAspectAdapter<MappedSuperclass, ChangeTracking>(getSubjectHolder()) { - @Override - protected ChangeTracking buildValue_() { - return ((EclipseLinkMappedSuperclass) this.subject).getChangeTracking(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java deleted file mode 100644 index 42ca0fe8ae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToManyMappingComposite.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.Cascade; -import org.eclipse.jpt.core.context.JoinTable; -import org.eclipse.jpt.core.context.OneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToManyMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -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.CascadeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.JoinTableComposite; -import org.eclipse.jpt.ui.internal.mappings.details.MappedByComposite; -import org.eclipse.jpt.ui.internal.mappings.details.OrderingComposite; -import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | TargetEntityComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | FetchTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | MappedByComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | OptionalComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | CascadeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | JoinColumnComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see OneToOneMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see CascadeComposite - * @see FetchTypeComposite - * @see JoinColumnComposite - * @see MappedByComposite - * @see OptionalComposite - * @see TargetEntityComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkOneToManyMappingComposite extends FormPane<OneToManyMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipselinkOneToManyMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IOneToManyMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkOneToManyMappingComposite(PropertyValueModel<? extends OneToManyMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeJoinTablePane(container); - } - - protected void initializeGeneralPane(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - Composite subPane = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - - new TargetEntityComposite(this, subPane); - new FetchTypeComposite(this, subPane); - new JoinFetchComposite(this, buildJoinFetchableHolder(), subPane); - new MappedByComposite(this, subPane); - new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), subPane); - new CascadeComposite(this, buildCascadeHolder(), addSubPane(container, 4)); - new OrderingComposite(this, container); - } - - protected void initializeJoinTablePane(Composite container) { - - container = addCollapsableSection( - container, - JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable - ); - - new JoinTableComposite( - this, - buildJoinTableHolder(), - container - ); - } - - protected PropertyValueModel<PrivateOwned> buildPrivateOwnableHolder() { - return new PropertyAspectAdapter<OneToManyMapping, PrivateOwned>(getSubjectHolder()) { - @Override - protected PrivateOwned buildValue_() { - return ((EclipseLinkOneToManyMapping) this.subject).getPrivateOwned(); - } - }; - } - - protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() { - return new PropertyAspectAdapter<OneToManyMapping, JoinFetch>(getSubjectHolder()) { - @Override - protected JoinFetch buildValue_() { - return ((EclipseLinkOneToManyMapping) this.subject).getJoinFetch(); - } - }; - } - - protected PropertyValueModel<Cascade> buildCascadeHolder() { - return new TransformationPropertyValueModel<OneToManyMapping, Cascade>(getSubjectHolder()) { - @Override - protected Cascade transform_(OneToManyMapping value) { - return value.getCascade(); - } - }; - } - - protected PropertyValueModel<JoinTable> buildJoinTableHolder() { - return new TransformationPropertyValueModel<OneToManyMapping, JoinTable>(getSubjectHolder()) { - @Override - protected JoinTable transform_(OneToManyMapping value) { - return value.getJoinTable(); - } - }; - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java deleted file mode 100644 index d6b483ed4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkOneToOneMappingComposite.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.context.Cascade; -import org.eclipse.jpt.core.context.OneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkOneToOneMapping; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.mappings.details.CascadeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.FetchTypeComposite; -import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnComposite; -import org.eclipse.jpt.ui.internal.mappings.details.MappedByComposite; -import org.eclipse.jpt.ui.internal.mappings.details.OptionalComposite; -import org.eclipse.jpt.ui.internal.mappings.details.TargetEntityComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | TargetEntityComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | FetchTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | MappedByComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | OptionalComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | CascadeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | JoinColumnComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see OneToOneMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see CascadeComposite - * @see FetchTypeComposite - * @see JoinColumnComposite - * @see MappedByComposite - * @see OptionalComposite - * @see TargetEntityComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkOneToOneMappingComposite extends FormPane<OneToOneMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipselinkOneToOneMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IOneToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkOneToOneMappingComposite(PropertyValueModel<? extends OneToOneMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - int groupBoxMargin = getGroupBoxMargin(); - Composite subPane = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin); - - new TargetEntityComposite(this, subPane); - new FetchTypeComposite(this, subPane); - new JoinFetchComposite(this, buildJoinFetchableHolder(), subPane); - new MappedByComposite(this, subPane); - new OptionalComposite(this, addSubPane(subPane, 4)); - new PrivateOwnedComposite(this, buildPrivateOwnableHolder(), subPane); - new CascadeComposite(this, buildCascadeHolder(), container); - new JoinColumnComposite(this, container); - } - - protected PropertyValueModel<JoinFetch> buildJoinFetchableHolder() { - return new PropertyAspectAdapter<OneToOneMapping, JoinFetch>(getSubjectHolder()) { - @Override - protected JoinFetch buildValue_() { - return ((EclipseLinkOneToOneMapping) this.subject).getJoinFetch(); - } - }; - } - - protected PropertyValueModel<PrivateOwned> buildPrivateOwnableHolder() { - return new PropertyAspectAdapter<OneToOneMapping, PrivateOwned>(getSubjectHolder()) { - @Override - protected PrivateOwned buildValue_() { - return ((EclipseLinkOneToOneMapping) this.subject).getPrivateOwned(); - } - }; - } - - protected PropertyValueModel<Cascade> buildCascadeHolder() { - return new TransformationPropertyValueModel<OneToOneMapping, Cascade>(getSubjectHolder()) { - - @Override - protected Cascade transform_(OneToOneMapping value) { - return value.getCascade(); - } - }; - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java deleted file mode 100644 index 0d768daabe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkTransformationMappingUiProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.TransformationMapping; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.internal.JptUiIcons; -import org.eclipse.swt.graphics.Image; - -public abstract class EclipseLinkTransformationMappingUiProvider<T extends TransformationMapping> - implements AttributeMappingUiProvider<T> -{ - - protected EclipseLinkTransformationMappingUiProvider() { - super(); - } - - public Image getImage() { - return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT); - } - - public String getLabel() { - return EclipseLinkUiMappingsMessages.TransformationMappingUiProvider_label; - } - - public String getLinkLabel() { - return EclipseLinkUiMappingsMessages.TransformationMappingUiProvider_linkLabel; - } - - public String getKey() { - return EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java deleted file mode 100644 index 58ce196648..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVariableOneToOneMappingUiProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.EclipseLinkMappingKeys; -import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.JptUiPlugin; -import org.eclipse.jpt.ui.details.AttributeMappingUiProvider; -import org.eclipse.jpt.ui.internal.JptUiIcons; -import org.eclipse.swt.graphics.Image; - -public abstract class EclipseLinkVariableOneToOneMappingUiProvider<T extends VariableOneToOneMapping> - implements AttributeMappingUiProvider<T> -{ - protected EclipseLinkVariableOneToOneMappingUiProvider() { - super(); - } - - public Image getImage() { - return JptUiPlugin.getImage(JptUiIcons.JPA_CONTENT); - } - - public String getLabel() { - return EclipseLinkUiMappingsMessages.VariableOneToOneMappingUiProvider_label; - } - - public String getLinkLabel() { - return EclipseLinkUiMappingsMessages.VariableOneToOneMappingUiProvider_linkLabel; - } - - public String getKey() { - return EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java deleted file mode 100644 index b23bfef90c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/EclipseLinkVersionMappingComposite.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 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.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.TemporalConverter; -import org.eclipse.jpt.core.context.VersionMapping; -import org.eclipse.jpt.eclipselink.core.context.Convert; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping; -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.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 | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | MutableComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * | ------------------------------------------------------------------------- | - * | | | | - * | | TemporalTypeComposite | | - * | | | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see VersionMapping - * @see BaseJpaUiFactory - The factory creating this pane - * @see ColumnComposite - * @see TemporalTypeComposite - * - * @version 2.1 - * @since 2.1 - */ -public class EclipseLinkVersionMappingComposite extends FormPane<VersionMapping> - implements JpaComposite -{ - /** - * Creates a new <code>VersionMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IVersionMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public EclipseLinkVersionMappingComposite(PropertyValueModel<? extends VersionMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - protected PropertyValueModel<Column> buildColumnHolder() { - return new TransformationPropertyValueModel<VersionMapping, Column>(getSubjectHolder()) { - @Override - protected Column transform_(VersionMapping value) { - return value.getColumn(); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - initializeGeneralPane(container); - initializeTypePane(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( - container, - 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<VersionMapping, 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<VersionMapping, 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<VersionMapping, 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<VersionMapping, 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<VersionMapping, Mutable>(getSubjectHolder()) { - @Override - protected Mutable buildValue_() { - return ((EclipseLinkVersionMapping) this.subject).getMutable(); - } - }; - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java deleted file mode 100644 index c8fc752f99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExpiryComposite.java +++ /dev/null @@ -1,302 +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.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.core.context.ExpiryTimeOfDay; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.util.ControlEnabler; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -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.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DateTime; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Spinner; - -/** - * Here is the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | - Expiry -------------------------------------------------------------- | | - * | | | | - * | | o No expiry | | - * | | ---------------- | | - * | | o Time to live expiry Expire after | I |I| milliseconds | | - * | | ---------------- | | - * | | -------------------- | | - * | | o Daily expiry Expire at | HH:MM:SS:AM/PM |I| | | - * | | -------------------- | | - * | ------------------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see EclipseLinkExpiryTimeOfDay - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class ExpiryComposite extends FormPane<Caching> { - - public ExpiryComposite(FormPane<? extends Caching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - // Expiry group pane - Group expiryGroupPane = addTitledGroup( - container, - EclipseLinkUiMappingsMessages.ExpiryComposite_expirySection, - 2, - null - ); - - // No Expiry radio button - Button button = addRadioButton( - expiryGroupPane, - EclipseLinkUiMappingsMessages.ExpiryComposite_noExpiry, - buildNoExpiryHolder(), - null - ); - GridData gridData = new GridData(); - gridData.horizontalSpan = 2; - button.setLayoutData(gridData); - - - // Time To Live Expiry radio button - addRadioButton( - expiryGroupPane, - EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiry, - buildExpiryHolder(), - null - ); - - addTimeToLiveComposite(expiryGroupPane); - - // Daily Expiry radio button - addRadioButton( - expiryGroupPane, - EclipseLinkUiMappingsMessages.ExpiryComposite_dailyExpiry, - buildTimeOfDayExpiryBooleanHolder(), - null - ); - - addTimeOfDayComposite(expiryGroupPane); - } - - protected void addTimeToLiveComposite(Composite parent) { - Composite container = this.addSubPane(parent, 3, 0, 10, 0, 0); - - - Control expireAfterLabel = addUnmanagedLabel( - container, - EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiryExpireAfter - ); - - Spinner expirySpinner = addUnmanagedSpinner( - container, - buildTimeToLiveExpiryHolder(), - -1, - -1, - Integer.MAX_VALUE, - null - ); - //a border Container is created in FormWidgetFactory.createSpinner - if (expirySpinner.getParent() != container) { - ((GridData) expirySpinner.getParent().getLayoutData()).grabExcessHorizontalSpace = false; - } - else { - ((GridData) expirySpinner.getLayoutData()).grabExcessHorizontalSpace = false; - } - - Control millisecondsLabel = addUnmanagedLabel( - container, - EclipseLinkUiMappingsMessages.ExpiryComposite_timeToLiveExpiryMilliseconds - ); - - new ControlEnabler(buildTimeToLiveExpiryEnabler(), expireAfterLabel, expirySpinner, millisecondsLabel); - } - - protected void addTimeOfDayComposite(Composite parent) { - Composite container = this.addSubPane(parent, 2, 0, 10, 0, 0); - - - Control expireAtLabel = addUnmanagedLabel( - container, - EclipseLinkUiMappingsMessages.ExpiryComposite_timeOfDayExpiryExpireAt - ); - - PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder = buildTimeOfDayExpiryHolder(); - DateTime dateTime = addUnmanagedDateTime( - container, - buildTimeOfDayExpiryHourHolder(timeOfDayExpiryHolder), - buildTimeOfDayExpiryMinuteHolder(timeOfDayExpiryHolder), - buildTimeOfDayExpirySecondHolder(timeOfDayExpiryHolder), - null); - - new ControlEnabler(buildTimeOfDayExpiryEnabler(), expireAtLabel, dateTime); - } - - private WritablePropertyValueModel<Boolean> buildNoExpiryHolder() { - return new PropertyAspectAdapter<Caching, Boolean>( - getSubjectHolder(), - Caching.EXPIRY_PROPERTY, - Caching.EXPIRY_TIME_OF_DAY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getExpiry() == null && this.subject.getExpiryTimeOfDay() == null); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setExpiry(null); - if (this.subject.getExpiryTimeOfDay() != null) { - this.subject.removeExpiryTimeOfDay(); - } - } - }; - } - - private WritablePropertyValueModel<Boolean> buildExpiryHolder() { - return new PropertyAspectAdapter<Caching, Boolean>( - getSubjectHolder(), - Caching.EXPIRY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getExpiry() != null); - } - - @Override - protected void setValue_(Boolean value) { - if (value == Boolean.TRUE) { - this.subject.setExpiry(0); - } - } - }; - } - - private WritablePropertyValueModel<Boolean> buildTimeOfDayExpiryBooleanHolder() { - return new PropertyAspectAdapter<Caching, Boolean>( - getSubjectHolder(), - Caching.EXPIRY_TIME_OF_DAY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getExpiryTimeOfDay() != null); - } - - @Override - protected void setValue_(Boolean value) { - if (value == Boolean.TRUE) { - this.subject.addExpiryTimeOfDay(); - } - } - }; - } - - private WritablePropertyValueModel<Integer> buildTimeToLiveExpiryHolder() { - return new PropertyAspectAdapter<Caching, Integer>(getSubjectHolder(), Caching.EXPIRY_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getExpiry(); - } - - @Override - protected void setValue_(Integer value) { - if (value == -1) { - value = null; - } - subject.setExpiry(value); - } - }; - } - - private PropertyValueModel<Boolean> buildTimeToLiveExpiryEnabler() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.EXPIRY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getExpiry() != null); - } - }; - } - - private PropertyValueModel<Boolean> buildTimeOfDayExpiryEnabler() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.EXPIRY_TIME_OF_DAY_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.getExpiryTimeOfDay() != null); - } - }; - } - - private PropertyValueModel<ExpiryTimeOfDay> buildTimeOfDayExpiryHolder() { - return new PropertyAspectAdapter<Caching, ExpiryTimeOfDay>(getSubjectHolder(), Caching.EXPIRY_TIME_OF_DAY_PROPERTY) { - @Override - protected ExpiryTimeOfDay buildValue_() { - return this.subject.getExpiryTimeOfDay(); - } - }; - } - - private WritablePropertyValueModel<Integer> buildTimeOfDayExpiryHourHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) { - return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>( - timeOfDayExpiryHolder, - ExpiryTimeOfDay.HOUR_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getHour(); - } - - @Override - protected void setValue_(Integer hour) { - this.subject.setHour(hour); - } - }; - } - - private WritablePropertyValueModel<Integer> buildTimeOfDayExpiryMinuteHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) { - return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>( - timeOfDayExpiryHolder, - ExpiryTimeOfDay.MINUTE_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getMinute(); - } - - @Override - protected void setValue_(Integer minute) { - this.subject.setMinute(minute); - } - }; - } - - private WritablePropertyValueModel<Integer> buildTimeOfDayExpirySecondHolder(PropertyValueModel<ExpiryTimeOfDay> timeOfDayExpiryHolder) { - return new PropertyAspectAdapter<ExpiryTimeOfDay, Integer>( - timeOfDayExpiryHolder, - ExpiryTimeOfDay.SECOND_PROPERTY) { - @Override - protected Integer buildValue_() { - return this.subject.getSecond(); - } - - @Override - protected void setValue_(Integer second) { - this.subject.setSecond(second); - } - }; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java deleted file mode 100644 index bd49227ae3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/JoinFetchComposite.java +++ /dev/null @@ -1,113 +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 java.util.Collection; -import org.eclipse.jpt.core.internal.JptCoreMessages; -import org.eclipse.jpt.eclipselink.core.context.JoinFetch; -import org.eclipse.jpt.eclipselink.core.context.JoinFetchType; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ---------------------------------------------------------- | - * | Join Fetch: | |v| | - * | ---------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see Fetchable - * @see BasicMappingComposite - A container of this widget - * @see ManyToManyMappingComposite - A container of this widget - * @see ManyToOneMappingComposite - A container of this widget - * @see OneToManyMappingComposite - A container of this widget - * @see OneToOneMappingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class JoinFetchComposite extends FormPane<JoinFetch> { - - /** - * Creates a new <code>JoinFetchComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public JoinFetchComposite(FormPane<?> parentPane, - PropertyValueModel<? extends JoinFetch> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - addLabeledComposite( - container, - addLabel( - container, - EclipseLinkUiMappingsMessages.JoinFetchComposite_label), - addJoinFetchTypeCombo(container).getControl(), - null - ); - } - - - private EnumFormComboViewer<JoinFetch, JoinFetchType> addJoinFetchTypeCombo(Composite container) { - - return new EnumFormComboViewer<JoinFetch, JoinFetchType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(JoinFetch.VALUE_PROPERTY); - } - - @Override - protected JoinFetchType[] getChoices() { - return JoinFetchType.values(); - } - - @Override - protected JoinFetchType getDefaultValue() { - return null; - } - - @Override - protected String displayString(JoinFetchType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - JoinFetchComposite.this, - value - ); - } - - @Override - protected String nullDisplayString() { - return JptCoreMessages.NONE; - } - - @Override - protected JoinFetchType getValue() { - return getSubject().getValue(); - } - - @Override - protected void setValue(JoinFetchType value) { - getSubject().setValue(value); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java deleted file mode 100644 index e9fc730d45..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/MutableComposite.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.Mutable; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows a tri-state check box for the Mutable option. - * - * @see Mutable - * @see EclipseLinkBasicMappingComposite - A container of this pane - * - * @version 2.1 - * @since 2.1 - */ -public class MutableComposite extends FormPane<Mutable> -{ - /** - * Creates a new <code>MutableComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public MutableComposite(FormPane<?> parentPane, - PropertyValueModel<? extends Mutable> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - addTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.MutableComposite_mutableLabel, - buildMutableHolder(), - buildMutableStringHolder(), - null - ); - } - - private WritablePropertyValueModel<Boolean> buildMutableHolder() { - return new PropertyAspectAdapter<Mutable, Boolean>(getSubjectHolder(), Mutable.SPECIFIED_MUTABLE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedMutable(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedMutable(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildMutableStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildMutableHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - boolean defaultValue = getSubject().isDefaultMutable(); - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.MutableComposite_mutableLabelDefault, - defaultStringValue - ); - } - - return EclipseLinkUiMappingsMessages.MutableComposite_mutableLabel; - } - }; - } - -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java deleted file mode 100644 index c34fb77eb4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ObjectTypeConverterComposite.java +++ /dev/null @@ -1,472 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import java.util.ListIterator; -import org.eclipse.jdt.ui.IJavaElementSearchConstants; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.eclipselink.core.context.ConversionValue; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.ObjectTypeConverter; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane; -import org.eclipse.jpt.ui.internal.widgets.AddRemoveTablePane; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.StringConverter; -import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter; -import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.utility.model.value.ListValueModel; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | -------------------------------------------------------------- | - * | Name: | || - * | -------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkConverter - * @see ConvertComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class ObjectTypeConverterComposite extends FormPane<ObjectTypeConverter> -{ - - /** - * Creates a new <code>ObjectTypeConverterComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ObjectTypeConverterComposite(PropertyValueModel<? extends ObjectTypeConverter> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel, - buildNameTextHolder()); - - addDataTypeChooser(container); - addObjectTypeChooser(container); - - addConversionValuesTable(container); - - addLabeledEditableCCombo( - container, - EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_defaultObjectValueLabel, - buildDefaultObjectValueListHolder(), - buildDefaultObjectValueHolder(), - buildStringConverter(), - null - ); - - new PaneEnabler(buildBooleanHolder(), this); - } - - protected WritablePropertyValueModel<String> buildNameTextHolder() { - return new PropertyAspectAdapter<ObjectTypeConverter, String>( - getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - this.subject.setName(value); - } - }; - } - - private ClassChooserPane<ObjectTypeConverter> addDataTypeChooser(Composite container) { - - return new ClassChooserPane<ObjectTypeConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<ObjectTypeConverter, String>(getSubjectHolder(), ObjectTypeConverter.DATA_TYPE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDataType(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setDataType(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getDataType(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_dataTypeLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setDataType(className); - } - }; - } - - private ClassChooserPane<ObjectTypeConverter> addObjectTypeChooser(Composite container) { - - return new ClassChooserPane<ObjectTypeConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<ObjectTypeConverter, String>(getSubjectHolder(), ObjectTypeConverter.OBJECT_TYPE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getObjectType(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setObjectType(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getObjectType(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_objectTypeLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setObjectType(className); - } - - @Override - protected int getTypeDialogStyle() { - return IJavaElementSearchConstants.CONSIDER_CLASSES_AND_ENUMS; - } - }; - } - - protected void addConversionValuesTable(Composite container) { - - // Join Columns group pane - Group conversionValuesGroupPane = addTitledGroup( - container, - EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesGroupTitle - ); - - WritablePropertyValueModel<ConversionValue> conversionValueHolder = - buildConversionValueHolder(); - // Conversion Values add/remove list pane - new AddRemoveTablePane<ObjectTypeConverter>( - this, - conversionValuesGroupPane, - buildConversionValuesAdapter(), - buildConversionValuesListModel(), - conversionValueHolder, - buildConversionValuesLabelProvider(), - null//TODO need a help context id for this - ) { - @Override - protected ColumnAdapter<ConversionValue> buildColumnAdapter() { - return new ConversionValueColumnAdapter(); - } - }; - - } - - protected WritablePropertyValueModel<ConversionValue> buildConversionValueHolder() { - return new SimplePropertyValueModel<ConversionValue>(); - } - - protected AddRemoveListPane.Adapter buildConversionValuesAdapter() { - return new AddRemoveListPane.AbstractAdapter() { - - public void addNewItem(ObjectListSelectionModel listSelectionModel) { - ConversionValueDialog dialog = buildConversionValueDialogForAdd(); - addConversionValueFromDialog(dialog, listSelectionModel); - } - - @Override - public boolean hasOptionalButton() { - return true; - } - - @Override - public String optionalButtonText() { - return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValueEdit; - } - - @Override - public void optionOnSelection(ObjectListSelectionModel listSelectionModel) { - ConversionValue conversionValue = (ConversionValue) listSelectionModel.selectedValue(); - ConversionValueDialog dialog = new ConversionValueDialog(getControl().getShell(), getSubject(), conversionValue); - editConversionValueFromDialog(dialog, conversionValue); - } - - public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) { - ObjectTypeConverter converter = getSubject(); - int[] selectedIndices = listSelectionModel.selectedIndices(); - - for (int index = selectedIndices.length; --index >= 0; ) { - converter.removeConversionValue(selectedIndices[index]); - } - } - }; - } - - - protected ConversionValueDialog buildConversionValueDialogForAdd() { - return new ConversionValueDialog(getControl().getShell(), getSubject()); - } - - protected void addConversionValueFromDialog(ConversionValueDialog dialog, ObjectListSelectionModel listSelectionModel) { - if (dialog.open() != Window.OK) { - return; - } - - ConversionValue conversionValue = this.getSubject().addConversionValue(); - conversionValue.setDataValue(dialog.getDataValue()); - conversionValue.setObjectValue(dialog.getObjectValue()); - - listSelectionModel.setSelectedValue(conversionValue); - } - - protected void editConversionValueFromDialog(ConversionValueDialog dialog, ConversionValue conversionValue) { - if (dialog.open() != Window.OK) { - return; - } - - conversionValue.setDataValue(dialog.getDataValue()); - conversionValue.setObjectValue(dialog.getObjectValue()); - } - - private ListValueModel<ConversionValue> buildConversionValuesListModel() { - return new ItemPropertyListValueModelAdapter<ConversionValue>(buildConversionValuesListHolder(), - ConversionValue.DATA_VALUE_PROPERTY, - ConversionValue.OBJECT_VALUE_PROPERTY); - } - - private ListValueModel<ConversionValue> buildConversionValuesListHolder() { - return new ListAspectAdapter<ObjectTypeConverter, ConversionValue>(getSubjectHolder(), ObjectTypeConverter.CONVERSION_VALUES_LIST) { - @Override - protected ListIterator<ConversionValue> listIterator_() { - return this.subject.conversionValues(); - } - - @Override - protected int size_() { - return this.subject.conversionValuesSize(); - } - }; - } - - private ITableLabelProvider buildConversionValuesLabelProvider() { - return new TableLabelProvider(); - } - - protected ListValueModel<String> buildDefaultObjectValueListHolder() { - return new TransformationListValueModelAdapter<ConversionValue, String>(buildConversionValuesListModel()) { - @Override - protected String transformItem(ConversionValue conversionValue) { - return conversionValue.getObjectValue(); - } - }; - } - - protected WritablePropertyValueModel<String> buildDefaultObjectValueHolder() { - return new PropertyAspectAdapter<ObjectTypeConverter, String>( - getSubjectHolder(), ObjectTypeConverter.DEFAULT_OBJECT_VALUE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDefaultObjectValue(); - } - - @Override - protected void setValue_(String value) { - if (value != null && value.length() == 0) { - value = null; - } - this.subject.setDefaultObjectValue(value); - } - }; - } - - protected final StringConverter<String> buildStringConverter() { - return new StringConverter<String>() { - public String convertToString(String value) { - return (value == null) ? "" : value; //$NON-NLS-1$ - } - }; - } - - protected PropertyValueModel<Boolean> buildBooleanHolder() { - return new TransformationPropertyValueModel<ObjectTypeConverter, Boolean>(getSubjectHolder()) { - @Override - protected Boolean transform(ObjectTypeConverter value) { - return Boolean.valueOf(value != null); - } - }; - } - - private class TableLabelProvider extends LabelProvider - implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - - ConversionValue conversionValue = (ConversionValue) element; - String value = null; - - switch (columnIndex) { - case ConversionValueColumnAdapter.DATA_VALUE_COLUMN: { - value = conversionValue.getDataValue(); - break; - } - - case ConversionValueColumnAdapter.OBJECT_VALUE_COLUMN: { - value = conversionValue.getObjectValue(); - break; - } - } - - if (value == null) { - value = ""; //$NON-NLS-1$ - } - - return value; - } - } - - private static class ConversionValueColumnAdapter implements ColumnAdapter<ConversionValue> { - - public static final int COLUMN_COUNT = 2; - //public static final int SELECTION_COLUMN = 0; - public static final int DATA_VALUE_COLUMN = 0; - public static final int OBJECT_VALUE_COLUMN = 1; - - private WritablePropertyValueModel<String> buildDataValueHolder(ConversionValue subject) { - return new PropertyAspectAdapter<ConversionValue, String>(ConversionValue.DATA_VALUE_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getDataValue(); - } - - @Override - protected void setValue_(String value) { - this.subject.setDataValue(value); - } - }; - } - - private WritablePropertyValueModel<String> buildObjectValueHolder(ConversionValue subject) { - return new PropertyAspectAdapter<ConversionValue, String>(ConversionValue.OBJECT_VALUE_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getObjectValue(); - } - - @Override - protected void setValue_(String value) { - this.subject.setObjectValue(value); - } - }; - } - - public WritablePropertyValueModel<?>[] cellModels(ConversionValue subject) { - WritablePropertyValueModel<?>[] holders = new WritablePropertyValueModel<?>[COLUMN_COUNT]; - //holders[SELECTION_COLUMN] = new SimplePropertyValueModel<Object>(); - holders[DATA_VALUE_COLUMN] = buildDataValueHolder(subject); - holders[OBJECT_VALUE_COLUMN] = buildObjectValueHolder(subject); - return holders; - } - - public int columnCount() { - return COLUMN_COUNT; - } - - public String columnName(int columnIndex) { - - switch (columnIndex) { - case ConversionValueColumnAdapter.DATA_VALUE_COLUMN: { - return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesDataValueColumn; - } - - case ConversionValueColumnAdapter.OBJECT_VALUE_COLUMN: { - return EclipseLinkUiMappingsMessages.ObjectTypeConverterComposite_conversionValuesObjectValueColumn; - } - - default: { - return null; - } - } - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java deleted file mode 100644 index 925202313c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/PrivateOwnedComposite.java +++ /dev/null @@ -1,67 +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.eclipselink.core.context.PrivateOwned; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows the Lob check box. - * - * @see BasicMapping - * - * @version 2.1 - * @since 2.1 - */ -public class PrivateOwnedComposite extends FormPane<PrivateOwned> -{ - /** - * Creates a new <code>PrivateOwnedComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public PrivateOwnedComposite(FormPane<?> parentPane, - PropertyValueModel<? extends PrivateOwned> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - private PropertyAspectAdapter<PrivateOwned, Boolean> buildPrivateOwnedHolder() { - - return new PropertyAspectAdapter<PrivateOwned, Boolean>(getSubjectHolder(), PrivateOwned.PRIVATE_OWNED_PROPERTY) { - - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isPrivateOwned()); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setPrivateOwned(value.booleanValue()); - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - addCheckBox( - container, - EclipseLinkUiMappingsMessages.PrivateOwnedComposite_privateOwnedLabel, - buildPrivateOwnedHolder(), - null - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java deleted file mode 100644 index 5d37ed00cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ReadOnlyComposite.java +++ /dev/null @@ -1,113 +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.eclipselink.core.context.ReadOnly; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows the Read Only check box. - * - * @see ReadOnly - * - * @version 2.1 - * @since 2.1 - */ -public class ReadOnlyComposite extends FormPane<ReadOnly> -{ - /** - * Creates a new <code>ReadOnlyComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ReadOnlyComposite(FormPane<?> parentPane, - PropertyValueModel<? extends ReadOnly> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - // Unique tri-state check box - addTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyLabel, - buildReadOnlyHolder(), - buildReadOnlyStringHolder(), - null - ); - } - - private WritablePropertyValueModel<Boolean> buildReadOnlyHolder() { - return new PropertyAspectAdapter<ReadOnly, Boolean>( - getSubjectHolder(), - ReadOnly.DEFAULT_READ_ONLY_PROPERTY, - ReadOnly.SPECIFIED_READ_ONLY_PROPERTY) - { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedReadOnly(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedReadOnly(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildReadOnlyStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildReadOnlyHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - - boolean defaultValue = getSubject().isDefaultReadOnly(); - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyWithDefault, - defaultStringValue - ); - } - - return EclipseLinkUiMappingsMessages.ReadOnlyComposite_readOnlyLabel; - } - }; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java deleted file mode 100644 index f8709fe06e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java +++ /dev/null @@ -1,112 +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.eclipselink.core.context.Caching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; - -/** - * This composite simply shows a tri-state check box for the Refresh Only If Newer option. - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class RefreshOnlyIfNewerComposite extends FormPane<Caching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public RefreshOnlyIfNewerComposite(FormPane<? extends Caching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildRefreshOnlyIfNewerHolder() { - return new PropertyAspectAdapter<Caching, Boolean>(getSubjectHolder(), Caching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getSpecifiedRefreshOnlyIfNewer(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setSpecifiedRefreshOnlyIfNewer(value); - } - - @Override - protected void subjectChanged() { - Object oldValue = this.getValue(); - super.subjectChanged(); - Object newValue = this.getValue(); - - // Make sure the default value is appended to the text - if (oldValue == newValue && newValue == null) { - this.fireAspectChange(Boolean.TRUE, newValue); - } - } - }; - } - - private PropertyValueModel<String> buildRefreshOnlyIfNewerStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildRefreshOnlyIfNewerHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((getSubject() != null) && (value == null)) { - - Boolean defaultValue = getSubject().isDefaultRefreshOnlyIfNewer(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - addTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel, - buildRefreshOnlyIfNewerHolder(), - buildRefreshOnlyIfNewerStringHolder(), - EclipseLinkHelpContextIds.CACHING_REFRESH_ONLY_IF_NEWER - ); - } -}
\ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java deleted file mode 100644 index 3204b35a64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/StructConverterComposite.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.StructConverter; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | -------------------------------------------------------------- | - * | Name: | || - * | -------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkConverter - * @see ConvertComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class StructConverterComposite extends FormPane<StructConverter> -{ - - /** - * Creates a new <code>StructConverterComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public StructConverterComposite(PropertyValueModel<? extends StructConverter> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel, - buildNameTextHolder()); - - addClassChooser(container); - - new PaneEnabler(buildBooleanHolder(), this); - } - - protected WritablePropertyValueModel<String> buildNameTextHolder() { - return new PropertyAspectAdapter<StructConverter, String>( - getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - this.subject.setName(value); - } - }; - } - - - private ClassChooserPane<StructConverter> addClassChooser(Composite container) { - - return new ClassChooserPane<StructConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<StructConverter, String>(getSubjectHolder(), StructConverter.CONVERTER_CLASS_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getConverterClass(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setConverterClass(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getConverterClass(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.ConverterComposite_classLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setConverterClass(className); - } - - @Override - protected String getSuperInterfaceName() { - return StructConverter.ECLIPSELINK_STRUCT_CONVERTER_CLASS_NAME; - } - }; - } - - protected PropertyValueModel<Boolean> buildBooleanHolder() { - return new TransformationPropertyValueModel<StructConverter, Boolean>(getSubjectHolder()) { - @Override - protected Boolean transform(StructConverter value) { - return Boolean.valueOf(value != null); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java deleted file mode 100644 index 2d70b233e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TransformationMappingComposite.java +++ /dev/null @@ -1,45 +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.eclipselink.core.context.TransformationMapping; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * - * @version 2.1 - * @since 2.1 - */ -public class TransformationMappingComposite extends FormPane<TransformationMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public TransformationMappingComposite(PropertyValueModel<? extends TransformationMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java deleted file mode 100644 index eb5066b065..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/TypeConverterComposite.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.core.JpaProject; -import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConverter; -import org.eclipse.jpt.eclipselink.core.context.TypeConverter; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.ClassChooserPane; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -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.widgets.Composite; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | -------------------------------------------------------------- | - * | Name: | || - * | -------------------------------------------------------------- | - * -----------------------------------------------------------------------------</pre> - * - * @see EclipseLinkConverter - * @see ConvertComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class TypeConverterComposite extends FormPane<TypeConverter> -{ - - /** - * Creates a new <code>TypeConverterComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public TypeConverterComposite(PropertyValueModel<? extends TypeConverter> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - addLabeledText( - container, - EclipseLinkUiMappingsMessages.ConverterComposite_nameTextLabel, - buildNameTextHolder()); - - addDataTypeChooser(container); - addObjectTypeChooser(container); - - new PaneEnabler(buildBooleanHolder(), this); - } - - protected WritablePropertyValueModel<String> buildNameTextHolder() { - return new PropertyAspectAdapter<TypeConverter, String>( - getSubjectHolder(), EclipseLinkConverter.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - - @Override - protected void setValue_(String value) { - if (value.length() == 0) { - value = null; - } - this.subject.setName(value); - } - }; - } - - - private ClassChooserPane<TypeConverter> addDataTypeChooser(Composite container) { - - return new ClassChooserPane<TypeConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<TypeConverter, String>(getSubjectHolder(), TypeConverter.DATA_TYPE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getDataType(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setDataType(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getDataType(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.TypeConverterComposite_dataTypeLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setDataType(className); - } - }; - } - - private ClassChooserPane<TypeConverter> addObjectTypeChooser(Composite container) { - - return new ClassChooserPane<TypeConverter>(this, container) { - - @Override - protected WritablePropertyValueModel<String> buildTextHolder() { - return new PropertyAspectAdapter<TypeConverter, String>(getSubjectHolder(), TypeConverter.OBJECT_TYPE_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getObjectType(); - } - - @Override - protected void setValue_(String value) { - - if (value.length() == 0) { - value = null; - } - - this.subject.setObjectType(value); - } - }; - } - - @Override - protected String getClassName() { - return getSubject().getObjectType(); - } - - @Override - protected String getLabelText() { - return EclipseLinkUiMappingsMessages.TypeConverterComposite_objectTypeLabel; - } - - @Override - protected JpaProject getJpaProject() { - return getSubject().getJpaProject(); - } - - @Override - protected void setClassName(String className) { - getSubject().setObjectType(className); - } - }; - } - - protected PropertyValueModel<Boolean> buildBooleanHolder() { - return new TransformationPropertyValueModel<TypeConverter, Boolean>(getSubjectHolder()) { - @Override - protected Boolean transform(TypeConverter value) { - return Boolean.valueOf(value != null); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java deleted file mode 100644 index ae6475a03f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/VariableOneToOneMappingComposite.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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.eclipselink.ui.internal.mappings.details; - -import org.eclipse.jpt.eclipselink.core.context.VariableOneToOneMapping; -import org.eclipse.jpt.ui.WidgetFactory; -import org.eclipse.jpt.ui.details.JpaComposite; -import org.eclipse.jpt.ui.internal.widgets.FormPane; -import org.eclipse.jpt.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * - * @version 2.2 - * @since 2.2 - */ -public class VariableOneToOneMappingComposite extends FormPane<VariableOneToOneMapping> - implements JpaComposite -{ - /** - * Creates a new <code>EclipseLinkBasicCollectionMappingComposite</code>. - * - * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code> - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - */ - public VariableOneToOneMappingComposite(PropertyValueModel<? extends VariableOneToOneMapping> subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - @Override - protected void initializeLayout(Composite container) { - - } -} |