diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java | 335 |
1 files changed, 0 insertions, 335 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java deleted file mode 100644 index af5589fe7c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java +++ /dev/null @@ -1,335 +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.ui.internal.mappings.details; - -import org.eclipse.jpt.ui.internal.JpaHelpContextIds; -import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages; -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; - -/** - * Here the layout of this pane: - * <pre> - * ----------------------------------------------------------------------------- - * | ------------------------------------------------------------------------- | - * | | | | - * | | BaseJoinColumnDialogPane | | - * | | | | - * | ------------------------------------------------------------------------- | - * | | - * | x Insertable | - * | | - * | x Nullable | - * | | - * | x Unique | - * | | - * | x Updatable | - * | | - * -----------------------------------------------------------------------------</pre> - * - * @see JoinColumnStateObject - * @see JoinColumnDialog - The parent container - * - * @version 2.0 - * @since 1.0 - */ -public class JoinColumnDialogPane<T extends JoinColumnStateObject> extends BaseJoinColumnDialogPane<T> -{ - /** - * Creates a new <code>JoinColumnDialogPane</code>. - * - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public JoinColumnDialogPane(PropertyValueModel<? extends T> subjectHolder, - Composite parent) - { - super(subjectHolder, parent); - } - - private WritablePropertyValueModel<Boolean> buildInsertableHolder() { - return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), JoinColumnStateObject.INSERTABLE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getInsertable(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setInsertable(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> buildInsertableStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildInsertableHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultInsertable(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - JptUiMappingsMessages.JoinColumnDialogPane_insertableWithDefault, - defaultStringValue - ); - } - } - - return JptUiMappingsMessages.JoinColumnDialogPane_insertable; - } - }; - } - - private WritablePropertyValueModel<Boolean> buildNullableHolder() { - return new PropertyAspectAdapter<T, Boolean>( - getSubjectHolder(), - JoinColumnStateObject.NULLABLE_PROPERTY) - { - @Override - protected Boolean buildValue_() { - return subject.getNullable(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setNullable(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> buildNullableStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildNullableHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultNullable(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - JptUiMappingsMessages.JoinColumnDialogPane_nullableWithDefault, - defaultStringValue - ); - } - } - - return JptUiMappingsMessages.JoinColumnDialogPane_nullable; - } - }; - } - - private WritablePropertyValueModel<Boolean> buildUniqueHolder() { - return new PropertyAspectAdapter<T, Boolean>( - getSubjectHolder(), - JoinColumnStateObject.UNIQUE_PROPERTY) - { - @Override - protected Boolean buildValue_() { - return subject.getUnique(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setUnique(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> buildUniqueStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildUniqueHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultUnique(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - JptUiMappingsMessages.JoinColumnDialogPane_uniqueWithDefault, - defaultStringValue - ); - } - } - - return JptUiMappingsMessages.JoinColumnDialogPane_unique; - } - }; - } - - private WritablePropertyValueModel<Boolean> buildUpdatableHolder() { - return new PropertyAspectAdapter<T, Boolean>(getSubjectHolder(), JoinColumnStateObject.UPDATABLE_PROPERTY) { - @Override - protected Boolean buildValue_() { - return subject.getUpdatable(); - } - - @Override - protected void setValue_(Boolean value) { - subject.setUpdatable(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> buildUpdatableStringHolder() { - - return new TransformationPropertyValueModel<Boolean, String>(buildUpdatableHolder()) { - - @Override - protected String transform(Boolean value) { - - if ((subject() != null) && (value == null)) { - - Boolean defaultValue = subject().getDefaultUpdatable(); - - if (defaultValue != null) { - - String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True : - JptUiMappingsMessages.Boolean_False; - - return NLS.bind( - JptUiMappingsMessages.JoinColumnDialogPane_updatableWithDefault, - defaultStringValue - ); - } - } - - return JptUiMappingsMessages.JoinColumnDialogPane_updatable; - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - super.initializeLayout(container); - - // Insertable tri-state check box - buildTriStateCheckBoxWithDefault( - buildSubPane(container, 4), - JptUiMappingsMessages.JoinColumnDialogPane_insertable, - buildInsertableHolder(), - buildInsertableStringHolder(), - JpaHelpContextIds.MAPPING_COLUMN_INSERTABLE - ); - - // Updatable tri-state check box - buildTriStateCheckBoxWithDefault( - container, - JptUiMappingsMessages.JoinColumnDialogPane_updatable, - buildUpdatableHolder(), - buildUpdatableStringHolder(), - JpaHelpContextIds.MAPPING_COLUMN_UPDATABLE - ); - - // Unique tri-state check box - buildTriStateCheckBoxWithDefault( - container, - JptUiMappingsMessages.ColumnComposite_unique, - buildUniqueHolder(), - buildUniqueStringHolder(), - JpaHelpContextIds.MAPPING_COLUMN_UNIQUE - ); - - // Nullable tri-state check box - buildTriStateCheckBoxWithDefault( - container, - JptUiMappingsMessages.ColumnComposite_nullable, - buildNullableHolder(), - buildNullableStringHolder(), - JpaHelpContextIds.MAPPING_COLUMN_NULLABLE - ); - } - - /* - * (non-Javadoc) - */ - @Override - protected boolean isTableEditable() { - return true; - } -}
\ No newline at end of file |