diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings')
9 files changed, 0 insertions, 1089 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 35b9c3793f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/EclipseLinkUiMappingsMessages.java +++ /dev/null @@ -1,65 +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; - -import org.eclipse.osgi.util.NLS; - -/** - * The localized strings used by the mapping panes. - * - * @version 2.0 - * @since 1.0 - */ -@SuppressWarnings("nls") -public class EclipseLinkUiMappingsMessages extends NLS { - - 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 EclipseLinkJavaEntityComposite_caching; - - 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 ExistenceCheckingComposite_label; - public static String ExistenceCheckingComposite_check_cache; - public static String ExistenceCheckingComposite_check_database; - public static String ExistenceCheckingComposite_assume_existence; - public static String ExistenceCheckingComposite_assume_non_existence; - - - - 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 28b8b8bfe5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/AlwaysRefreshComposite.java +++ /dev/null @@ -1,116 +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.EclipseLinkCaching; -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.AbstractFormPane; -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 AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public AlwaysRefreshComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildAlwaysRefreshHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.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 ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultAlwaysRefresh(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.AlwaysRefreshComposite_alwaysRefreshLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - 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/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 f2bd9cb60e..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.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -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 AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheCoordinationTypeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<EclipseLinkCaching, CacheCoordinationType> buildCacheCoordinationTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, CacheCoordinationType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_COORDINATION_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_COORDINATION_TYPE_PROPERTY); - } - - @Override - protected CacheCoordinationType[] choices() { - return CacheCoordinationType.values(); - } - - @Override - protected CacheCoordinationType defaultValue() { - return subject().getDefaultCoordinationType(); - } - - @Override - protected String displayString(CacheCoordinationType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheCoordinationTypeComposite.this, - value - ); - } - - @Override - protected CacheCoordinationType getValue() { - return subject().getSpecifiedCoordinationType(); - } - - @Override - protected void setValue(CacheCoordinationType value) { - subject().setSpecifiedCoordinationType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - buildLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheCoordinationTypeComposite_label, - buildCacheCoordinationTypeCombo(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 3cf27cf686..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.EclipseLinkCaching; -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.AbstractFormPane; -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 AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheSizeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheSizeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - // Size widgets - Spinner sizeSpinner = buildLabeledSpinner( - container, - EclipseLinkUiMappingsMessages.CacheSizeComposite_size, - buildSizeHolder(), - -1, - -1, - Integer.MAX_VALUE, - buildDefaultSizeLabel(container)//, - //TODO JpaHelpContextIds.MAPPING_COLUMN_LENGTH - ); - - updateGridData(container, sizeSpinner); - } - - private WritablePropertyValueModel<Integer> buildSizeHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Integer>(getSubjectHolder(), EclipseLinkCaching.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<EclipseLinkCaching, Integer>(getSubjectHolder(), EclipseLinkCaching.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 buildDefaultSizeLabel(Composite container) { - - Label label = buildLabel( - container, - JptUiMappingsMessages.DefaultWithoutValue - ); - - 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 = (subject() != null) ? subject().getDefaultSize() : - EclipseLinkCaching.DEFAULT_SIZE; - - return NLS.bind( - JptUiMappingsMessages.DefaultWithValue, - 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 2dae68f452..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.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkHelpContextIds; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -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 AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>CacheTypeComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public CacheTypeComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - private EnumFormComboViewer<EclipseLinkCaching, CacheType> buildCacheTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, CacheType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_TYPE_PROPERTY); - } - - @Override - protected CacheType[] choices() { - return CacheType.values(); - } - - @Override - protected CacheType defaultValue() { - return subject().getDefaultType(); - } - - @Override - protected String displayString(CacheType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - CacheTypeComposite.this, - value - ); - } - - @Override - protected CacheType getValue() { - return subject().getSpecifiedType(); - } - - @Override - protected void setValue(CacheType value) { - subject().setSpecifiedType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - @Override - protected void initializeLayout(Composite container) { - - buildLabeledComposite( - container, - EclipseLinkUiMappingsMessages.CacheTypeComposite_label, - buildCacheTypeCombo(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 9fbc9dbcb1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/CachingComposite.java +++ /dev/null @@ -1,165 +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.EclipseLinkCaching; -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.util.PaneEnabler; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.AbstractPane; -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 | - * | AlwaysRefreshComposite | - * | RefreshOnlyIfNewerComposite | - * | DisableHitsComposite | - * -----------------------------------------------------------------------------</pre> - * - * @see Entity - * @see EclipseLinkCaching - * @see EclipseLinkJavaEntityComposite - The parent container - * @see CacheTypeComposite - * @see AlwaysRefreshComposite - * @see RefreshOnlyIfNewerComposite - * @see DisableHitsComposite - * - * @version 2.1 - * @since 2.1 - */ -public class CachingComposite extends AbstractFormPane<EclipseLinkCaching> -{ - - public CachingComposite(AbstractFormPane<?> parentPane, - PropertyValueModel<EclipseLinkCaching> subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - //Shared Check box, uncheck this and the rest of the panel is disabled - buildTriStateCheckBoxWithDefault( - buildSubPane(container, 8), - EclipseLinkUiMappingsMessages.CachingComposite_sharedLabel, - buildSharedHolder(), - buildSharedStringHolder(), - EclipseLinkHelpContextIds.CACHING_SHARED - ); - - Composite subPane = buildSubPane(container, 0, 16); - - Collection<AbstractPane<?>> panes = new ArrayList<AbstractPane<?>>(); - - panes.add(new CacheTypeComposite(this, subPane)); - panes.add(new CacheSizeComposite(this, subPane)); - - // Advanced sub-pane - Composite advancedSection = buildCollapsableSubSection( - subPane, - EclipseLinkUiMappingsMessages.CachingComposite_advanced, - new SimplePropertyValueModel<Boolean>(Boolean.FALSE) - ); - - initializeAdvancedPane(buildSubPane(advancedSection, 0, 16), panes); - - new PaneEnabler(buildSharedCacheEnabler(), panes); - - new ExistenceCheckingComposite(this, buildSubPane(container, 8)); - } - - private void initializeAdvancedPane(Composite container, Collection<AbstractPane<?>> panes) { - panes.add(new AlwaysRefreshComposite(this, container)); - panes.add(new RefreshOnlyIfNewerComposite(this, container)); - panes.add(new DisableHitsComposite(this, container)); - panes.add(new CacheCoordinationTypeComposite(this, container)); - } - - private PropertyValueModel<Boolean> buildSharedCacheEnabler() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.SPECIFIED_SHARED_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.getShared(); - } - }; - } - private WritablePropertyValueModel<Boolean> buildSharedHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.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 ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultShared(); - - if (defaultValue != null) { - - 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/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 f509f4d3cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/DisableHitsComposite.java +++ /dev/null @@ -1,115 +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.EclipseLinkCaching; -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.AbstractFormPane; -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 AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public DisableHitsComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildDisableHitsHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.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 ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultDisableHits(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.DisableHitsComposite_disableHitsLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - 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/ExistenceCheckingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExistenceCheckingComposite.java deleted file mode 100644 index b8689bc377..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/ExistenceCheckingComposite.java +++ /dev/null @@ -1,125 +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.EclipseLinkCaching; -import org.eclipse.jpt.eclipselink.core.context.ExistenceType; -import org.eclipse.jpt.eclipselink.ui.internal.mappings.EclipseLinkUiMappingsMessages; -import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane; -import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer; -import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * Here is the layout of this pane: - * <pre> - * ------------------------------------------------------------------------- - * | ---------------------------------------------- | - * | x Existence Checking: | |v| | - * | ---------------------------------------------- | - * -------------------------------------------------------------------------</pre> - * - * @see EclipseLinkCaching - * @see CachingComposite - A container of this widget - * - * @version 2.1 - * @since 2.1 - */ -public class ExistenceCheckingComposite extends AbstractFormPane<EclipseLinkCaching> { - - /** - * Creates a new <code>ExistenceCheckingComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public ExistenceCheckingComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) { - - super(parentPane, parent); - } - - @Override - protected void initializeLayout(Composite container) { - Composite subPane = buildSubPane(container, 2, 8, 0, 0, 0); - - - buildCheckBox( - subPane, - EclipseLinkUiMappingsMessages.ExistenceCheckingComposite_label, - buildExistenceCheckingHolder()); - - - buildExistenceCheckingTypeCombo(subPane); - } - - private EnumFormComboViewer<EclipseLinkCaching, ExistenceType> buildExistenceCheckingTypeCombo(Composite container) { - - return new EnumFormComboViewer<EclipseLinkCaching, ExistenceType>(this, container) { - - @Override - protected void addPropertyNames(Collection<String> propertyNames) { - super.addPropertyNames(propertyNames); - propertyNames.add(EclipseLinkCaching.DEFAULT_EXISTENCE_TYPE_PROPERTY); - propertyNames.add(EclipseLinkCaching.SPECIFIED_EXISTENCE_TYPE_PROPERTY); - } - - @Override - protected ExistenceType[] choices() { - return ExistenceType.values(); - } - - @Override - protected ExistenceType defaultValue() { - return subject().getDefaultExistenceType(); - } - - @Override - protected String displayString(ExistenceType value) { - return buildDisplayString( - EclipseLinkUiMappingsMessages.class, - ExistenceCheckingComposite.this, - value - ); - } - - @Override - protected ExistenceType getValue() { - return subject().getSpecifiedExistenceType(); - } - - @Override - protected void setValue(ExistenceType value) { - subject().setSpecifiedExistenceType(value); - } - - @Override - protected boolean sortChoices() { - return false; - } - }; - } - - private WritablePropertyValueModel<Boolean> buildExistenceCheckingHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.EXISTENCE_CHECKING_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.hasExistenceChecking(); - } - - @Override - protected void setValue_(Boolean value) { - this.subject.setExistenceChecking(value); - } - }; - } - -} 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 8f99e664b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/mappings/details/RefreshOnlyIfNewerComposite.java +++ /dev/null @@ -1,115 +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.EclipseLinkCaching; -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.AbstractFormPane; -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 AbstractFormPane<EclipseLinkCaching> -{ - /** - * Creates a new <code>OptionalComposite</code>. - * - * @param parentPane The parent container of this one - * @param parent The parent container - */ - public RefreshOnlyIfNewerComposite(AbstractFormPane<? extends EclipseLinkCaching> parentPane, - Composite parent) - { - super(parentPane, parent); - } - - private WritablePropertyValueModel<Boolean> buildRefreshOnlyIfNewerHolder() { - return new PropertyAspectAdapter<EclipseLinkCaching, Boolean>(getSubjectHolder(), EclipseLinkCaching.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 ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultRefreshOnlyIfNewer(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerDefault, - defaultStringValue - ); - } - } - - return EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - buildTriStateCheckBoxWithDefault( - container, - EclipseLinkUiMappingsMessages.RefreshOnlyIfNewerComposite_refreshOnlyIfNewerLabel, - buildRefreshOnlyIfNewerHolder(), - buildRefreshOnlyIfNewerStringHolder(), - EclipseLinkHelpContextIds.CACHING_REFRESH_ONLY_IF_NEWER - ); - } -}
\ No newline at end of file |