diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java new file mode 100644 index 0000000000..9c39925800 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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.jpa2.persistence.options; + +import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0; +import org.eclipse.jpt.ui.internal.jpa2.persistence.JptUiPersistence2_0Messages; +import org.eclipse.jpt.ui.internal.widgets.IntegerCombo; +import org.eclipse.jpt.ui.internal.widgets.Pane; +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; + +/** + * LockingConfigurationComposite + */ +public class LockingConfigurationComposite extends Pane<JpaOptions2_0> +{ + /** + * Creates a new <code>LockingConfigurationComposite</code>. + * + * @param parentController + * The parent container of this one + * @param parent + * The parent container + */ + public LockingConfigurationComposite( + Pane<? extends JpaOptions2_0> parentComposite, + Composite parent) { + + super(parentComposite, parent); + } + + @Override + protected void initializeLayout(Composite parent) { + this.addLockTimeoutCombo(parent); + } + + private void addLockTimeoutCombo(Composite parent) { + new IntegerCombo<JpaOptions2_0>(this, parent) { + + @Override + protected String getLabelText() { + return JptUiPersistence2_0Messages.LockingConfigurationComposite_lockTimeoutLabel; + } + + @Override + protected String getHelpId() { + return null; // TODO + } + + @Override + protected PropertyValueModel<Integer> buildDefaultHolder() { + return new PropertyAspectAdapter<JpaOptions2_0, Integer>(this.getSubjectHolder()) { + @Override + protected Integer buildValue_() { + return this.subject.getDefaultLockTimeout(); + } + }; + } + + @Override + protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() { + return new PropertyAspectAdapter<JpaOptions2_0, Integer>(this.getSubjectHolder(), JpaOptions2_0.LOCK_TIMEOUT_PROPERTY) { + @Override + protected Integer buildValue_() { + return this.subject.getLockTimeout(); + } + + @Override + protected void setValue_(Integer value) { + this.subject.setLockTimeout(value); + } + }; + } + }; + } +}
\ No newline at end of file |