1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*******************************************************************************
* Copyright (c) 2006, 2013 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.jpa.ui.internal.jpa2.details.java;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jpt.common.ui.WidgetFactory;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEntity2_0;
import org.eclipse.jpt.jpa.ui.JptJpaUiMessages;
import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages;
import org.eclipse.jpt.jpa.ui.internal.details.AbstractEntityComposite;
import org.eclipse.jpt.jpa.ui.internal.details.AccessTypeComboViewer;
import org.eclipse.jpt.jpa.ui.internal.details.EntityNameCombo;
import org.eclipse.jpt.jpa.ui.internal.details.IdClassChooser;
import org.eclipse.jpt.jpa.ui.internal.details.TableComposite;
import org.eclipse.jpt.jpa.ui.internal.details.java.JavaInheritanceComposite;
import org.eclipse.jpt.jpa.ui.internal.details.java.JavaSecondaryTablesComposite;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.Cacheable2_0TriStateCheckBox;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.EntityOverridesComposite2_0;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.QueriesComposite2_0;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.Hyperlink;
public class JavaEntity2_0Composite
extends AbstractEntityComposite<JavaEntity2_0>
{
public JavaEntity2_0Composite(
PropertyValueModel<? extends JavaEntity2_0> entityModel,
Composite parentComposite,
WidgetFactory widgetFactory,
ResourceManager resourceManager) {
super(entityModel, parentComposite, widgetFactory, resourceManager);
}
@Override
protected Control initializeEntitySection(Composite container) {
container = this.addSubPane(container, 2, 0, 0, 0, 0);
// Table widgets
TableComposite tableComposite = new TableComposite(this, container);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
tableComposite.getControl().setLayoutData(gridData);
// Entity name widgets
this.addLabel(container, JptJpaUiDetailsMessages.EntityNameComposite_name);
new EntityNameCombo(this, container);
// Access type widgets
this.addLabel(container, JptJpaUiMessages.AccessTypeComposite_access);
new AccessTypeComboViewer(this, buildAccessReferenceModel(), container);
// Id class widgets
Hyperlink hyperlink = this.addHyperlink(container,JptJpaUiDetailsMessages.IdClassComposite_label);
new IdClassChooser(this, this.buildIdClassReferenceModel(), container, hyperlink);
// Cacheable widgets
Cacheable2_0TriStateCheckBox cacheableCheckBox = new Cacheable2_0TriStateCheckBox(this, buildCacheableModel(), container);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
cacheableCheckBox.getControl().setLayoutData(gridData);
return container;
}
protected PropertyValueModel<Cacheable2_0> buildCacheableModel() {
return new PropertyAspectAdapter<JavaEntity2_0, Cacheable2_0>(getSubjectHolder()) {
@Override
protected Cacheable2_0 buildValue_() {
return this.subject.getCacheable();
}
};
}
@Override
protected Control initializeSecondaryTablesSection(Composite container) {
return new JavaSecondaryTablesComposite(this, container).getControl();
}
@Override
protected Control initializeInheritanceSection(Composite container) {
return new JavaInheritanceComposite(this, container).getControl();
}
@Override
protected Control initializeAttributeOverridesSection(Composite container) {
return new EntityOverridesComposite2_0(this, container).getControl();
}
@Override
protected Control initializeQueriesSection(Composite container) {
return new QueriesComposite2_0(this, this.buildQueryContainerModel(), container).getControl();
}
}
|