| /******************************************************************************* |
| * Copyright (c) 2008, 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.persistence.connection; |
| |
| import org.eclipse.jpt.eclipselink.core.internal.context.persistence.connection.Connection; |
| import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages; |
| import org.eclipse.jpt.ui.internal.JpaHelpContextIds; |
| 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; |
| |
| /** |
| * JdbcWriteConnectionsMinComposite |
| */ |
| public class JdbcWriteConnectionsMinComposite extends Pane<Connection> |
| { |
| /** |
| * Creates a new <code>JdbcWriteConnectionsMinComposite</code>. |
| * |
| * @param parentController |
| * The parent container of this one |
| * @param parent |
| * The parent container |
| */ |
| public JdbcWriteConnectionsMinComposite(Pane<Connection> parentComposite, |
| Composite parent) { |
| |
| super(parentComposite, parent); |
| } |
| |
| @Override |
| protected void initializeLayout(Composite container) { |
| addWriteConnectionsMinCombo(container); |
| } |
| |
| private void addWriteConnectionsMinCombo(Composite container) { |
| new IntegerCombo<Connection>(this, container) { |
| |
| @Override |
| protected String getLabelText() { |
| return EclipseLinkUiMessages.PersistenceXmlConnectionTab_writeConnectionsMinLabel; |
| } |
| |
| @Override |
| protected String getHelpId() { |
| return JpaHelpContextIds.PERSISTENCE_XML_CONNECTION; |
| } |
| |
| @Override |
| protected PropertyValueModel<Integer> buildDefaultHolder() { |
| return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder()) { |
| @Override |
| protected Integer buildValue_() { |
| return this.subject.getDefaultWriteConnectionsMin(); |
| } |
| }; |
| } |
| |
| @Override |
| protected WritablePropertyValueModel<Integer> buildSelectedItemHolder() { |
| return new PropertyAspectAdapter<Connection, Integer>(getSubjectHolder(), Connection.WRITE_CONNECTIONS_MIN_PROPERTY) { |
| @Override |
| protected Integer buildValue_() { |
| return this.subject.getWriteConnectionsMin(); |
| } |
| |
| @Override |
| protected void setValue_(Integer value) { |
| this.subject.setWriteConnectionsMin(value); |
| } |
| }; |
| } |
| }; |
| } |
| } |