|
Lines 11-17
Link Here
|
| 11 |
|
11 |
|
| 12 |
import java.util.Collection; |
12 |
import java.util.Collection; |
| 13 |
import java.util.Iterator; |
13 |
import java.util.Iterator; |
| 14 |
|
|
|
| 15 |
import org.eclipse.jpt.core.context.BaseColumn; |
14 |
import org.eclipse.jpt.core.context.BaseColumn; |
| 16 |
import org.eclipse.jpt.core.context.Column; |
15 |
import org.eclipse.jpt.core.context.Column; |
| 17 |
import org.eclipse.jpt.core.context.NamedColumn; |
16 |
import org.eclipse.jpt.core.context.NamedColumn; |
|
Lines 30-142
Link Here
|
| 30 |
import org.eclipse.osgi.util.NLS; |
29 |
import org.eclipse.osgi.util.NLS; |
| 31 |
import org.eclipse.swt.widgets.Composite; |
30 |
import org.eclipse.swt.widgets.Composite; |
| 32 |
|
31 |
|
| 33 |
/** |
32 |
public class ColumnComposite |
| 34 |
* Here the layout of this pane: |
33 |
extends Pane<Column> |
| 35 |
* <pre> |
34 |
{ |
| 36 |
* ----------------------------------------------------------------------------- |
35 |
public ColumnComposite( |
| 37 |
* | ------------------------------------------------------------------------- | |
36 |
Pane<?> parentPane, |
| 38 |
* | | | | |
37 |
PropertyValueModel<? extends Column> subjectHolder, |
| 39 |
* | | ColumnCombo | | |
38 |
Composite parent) { |
| 40 |
* | | | | |
39 |
|
| 41 |
* | ------------------------------------------------------------------------- | |
|
|
| 42 |
* | ------------------------------------------------------------------------- | |
| 43 |
* | | | | |
| 44 |
* | | TableCombo | | |
| 45 |
* | | | | |
| 46 |
* | ------------------------------------------------------------------------- | |
| 47 |
* | | |
| 48 |
* | > Details | |
| 49 |
* | | |
| 50 |
* | x Insertable | |
| 51 |
* | | |
| 52 |
* | x Updatable | |
| 53 |
* | | |
| 54 |
* | x Unique | |
| 55 |
* | | |
| 56 |
* | x Nullable | |
| 57 |
* | | |
| 58 |
* | --------------- | |
| 59 |
* | Length: | I |I| Default (XXX) | |
| 60 |
* | --------------- | |
| 61 |
* | --------------- | |
| 62 |
* | Precision: | I |I| Default (XXX) | |
| 63 |
* | --------------- | |
| 64 |
* | --------------- | |
| 65 |
* | Scale: | I |I| Default (XXX) | |
| 66 |
* | --------------- | |
| 67 |
* | ---------------------------------------------------- | |
| 68 |
* | Column Definition: | I | | |
| 69 |
* | ---------------------------------------------------- | |
| 70 |
* -----------------------------------------------------------------------------</pre> |
| 71 |
* |
| 72 |
* @see Column |
| 73 |
* @see ColumnCombo |
| 74 |
* @see TableCombo |
| 75 |
* @see BasicMappingComposite - A container of this pane |
| 76 |
* @see EmbeddedMappingOverridesComposite - A container of this pane |
| 77 |
* @see IdMappingComposite - A container of this pane |
| 78 |
* @see VersionMappingComposite - A container of this pane |
| 79 |
* |
| 80 |
* @version 2.0 |
| 81 |
* @since 1.0 |
| 82 |
*/ |
| 83 |
public class ColumnComposite extends Pane<Column> { |
| 84 |
|
| 85 |
/** |
| 86 |
* Creates a new <code>ColumnComposite</code>. |
| 87 |
* |
| 88 |
* @param parentPane The parent container of this one |
| 89 |
* @param subjectHolder The holder of the subject <code>IColumn</code> |
| 90 |
* @param parent The parent container |
| 91 |
*/ |
| 92 |
public ColumnComposite(Pane<?> parentPane, |
| 93 |
PropertyValueModel<? extends Column> subjectHolder, |
| 94 |
Composite parent) { |
| 95 |
|
| 96 |
super(parentPane, subjectHolder, parent, false); |
40 |
super(parentPane, subjectHolder, parent, false); |
| 97 |
} |
41 |
} |
| 98 |
|
42 |
|
| 99 |
/** |
43 |
public ColumnComposite( |
| 100 |
* Creates a new <code>ColumnComposite</code>. |
44 |
Pane<?> parentPane, |
| 101 |
* |
45 |
PropertyValueModel<? extends Column> subjectHolder, |
| 102 |
* @param parentPane The parent container of this one |
46 |
Composite parent, |
| 103 |
* @param subjectHolder The holder of the subject <code>IColumn</code> |
47 |
boolean automaticallyAlignWidgets) { |
| 104 |
* @param parent The parent container |
48 |
|
| 105 |
* @param automaticallyAlignWidgets <code>true</code> to make the widgets |
|
|
| 106 |
* this pane aligned with the widgets of the given parent controller; |
| 107 |
* <code>false</code> to not align them |
| 108 |
*/ |
| 109 |
public ColumnComposite(Pane<?> parentPane, |
| 110 |
PropertyValueModel<? extends Column> subjectHolder, |
| 111 |
Composite parent, |
| 112 |
boolean automaticallyAlignWidgets) { |
| 113 |
|
| 114 |
super(parentPane, subjectHolder, parent, automaticallyAlignWidgets); |
49 |
super(parentPane, subjectHolder, parent, automaticallyAlignWidgets); |
| 115 |
} |
50 |
} |
| 116 |
|
51 |
|
| 117 |
/** |
52 |
public ColumnComposite( |
| 118 |
* Creates a new <code>ColumnComposite</code>. |
53 |
Pane<?> parentPane, |
| 119 |
* |
54 |
PropertyValueModel<? extends Column> subjectHolder, |
| 120 |
* @param parentPane The parent container of this one |
55 |
Composite parent, |
| 121 |
* @param subjectHolder The holder of the subject <code>IColumn</code> |
56 |
boolean automaticallyAlignWidgets, |
| 122 |
* @param parent The parent container |
57 |
boolean parentManagePane) { |
| 123 |
* @param automaticallyAlignWidgets <code>true</code> to make the widgets |
58 |
|
| 124 |
* this pane aligned with the widgets of the given parent controller; |
|
|
| 125 |
* <code>false</code> to not align them |
| 126 |
*/ |
| 127 |
public ColumnComposite(Pane<?> parentPane, |
| 128 |
PropertyValueModel<? extends Column> subjectHolder, |
| 129 |
Composite parent, |
| 130 |
boolean automaticallyAlignWidgets, |
| 131 |
boolean parentManagePane) { |
| 132 |
|
| 133 |
super(parentPane, subjectHolder, parent, automaticallyAlignWidgets, parentManagePane); |
59 |
super(parentPane, subjectHolder, parent, automaticallyAlignWidgets, parentManagePane); |
| 134 |
} |
60 |
} |
| 135 |
|
61 |
|
|
|
62 |
|
| 136 |
private ColumnCombo<Column> addColumnCombo(Composite container) { |
63 |
private ColumnCombo<Column> addColumnCombo(Composite container) { |
| 137 |
|
64 |
|
| 138 |
return new ColumnCombo<Column>(this, container) { |
65 |
return new ColumnCombo<Column>(this, container) { |
| 139 |
|
|
|
| 140 |
@Override |
66 |
@Override |
| 141 |
protected void addPropertyNames(Collection<String> propertyNames) { |
67 |
protected void addPropertyNames(Collection<String> propertyNames) { |
| 142 |
super.addPropertyNames(propertyNames); |
68 |
super.addPropertyNames(propertyNames); |
|
Lines 145-151
Link Here
|
| 145 |
propertyNames.add(BaseColumn.DEFAULT_TABLE_PROPERTY); |
71 |
propertyNames.add(BaseColumn.DEFAULT_TABLE_PROPERTY); |
| 146 |
propertyNames.add(BaseColumn.SPECIFIED_TABLE_PROPERTY); |
72 |
propertyNames.add(BaseColumn.SPECIFIED_TABLE_PROPERTY); |
| 147 |
} |
73 |
} |
| 148 |
|
74 |
|
| 149 |
@Override |
75 |
@Override |
| 150 |
protected void propertyChanged(String propertyName) { |
76 |
protected void propertyChanged(String propertyName) { |
| 151 |
if (propertyName == BaseColumn.DEFAULT_TABLE_PROPERTY || |
77 |
if (propertyName == BaseColumn.DEFAULT_TABLE_PROPERTY || |
|
Lines 155-194
Link Here
|
| 155 |
super.propertyChanged(propertyName); |
81 |
super.propertyChanged(propertyName); |
| 156 |
} |
82 |
} |
| 157 |
} |
83 |
} |
| 158 |
|
84 |
|
| 159 |
@Override |
85 |
@Override |
| 160 |
protected String getDefaultValue() { |
86 |
protected String getDefaultValue() { |
| 161 |
return getSubject().getDefaultName(); |
87 |
return getSubject().getDefaultName(); |
| 162 |
} |
88 |
} |
| 163 |
|
89 |
|
| 164 |
@Override |
90 |
@Override |
| 165 |
protected void setValue(String value) { |
91 |
protected void setValue(String value) { |
| 166 |
getSubject().setSpecifiedName(value); |
92 |
getSubject().setSpecifiedName(value); |
| 167 |
} |
93 |
} |
| 168 |
|
94 |
|
| 169 |
@Override |
95 |
@Override |
| 170 |
protected Table getDbTable_() { |
96 |
protected Table getDbTable_() { |
| 171 |
return getSubject().getDbTable(); |
97 |
return getSubject().getDbTable(); |
| 172 |
} |
98 |
} |
| 173 |
|
99 |
|
| 174 |
@Override |
100 |
@Override |
| 175 |
protected String getValue() { |
101 |
protected String getValue() { |
| 176 |
return getSubject().getSpecifiedName(); |
102 |
return getSubject().getSpecifiedName(); |
| 177 |
} |
103 |
} |
|
|
104 |
|
| 105 |
@Override |
| 106 |
protected String buildNullDefaultValueEntry() { |
| 107 |
return NLS.bind( |
| 108 |
JptUiDetailsMessages.DefaultWithOneParam, |
| 109 |
JptUiDetailsMessages.NoneSelected); |
| 110 |
} |
| 111 |
|
| 178 |
@Override |
112 |
@Override |
| 179 |
public String toString() { |
113 |
public String toString() { |
| 180 |
return "ColumnComposite.columnCombo"; //$NON-NLS-1$ |
114 |
return "ColumnComposite.columnCombo"; //$NON-NLS-1$ |
| 181 |
} |
115 |
} |
| 182 |
}; |
116 |
}; |
| 183 |
} |
117 |
} |
| 184 |
|
118 |
|
| 185 |
private WritablePropertyValueModel<String> buildColumnDefinitionHolder() { |
119 |
private WritablePropertyValueModel<String> buildColumnDefinitionHolder() { |
| 186 |
return new PropertyAspectAdapter<Column, String>(getSubjectHolder(), NamedColumn.COLUMN_DEFINITION_PROPERTY) { |
120 |
return new PropertyAspectAdapter<Column, String>(getSubjectHolder(), NamedColumn.COLUMN_DEFINITION_PROPERTY) { |
| 187 |
@Override |
121 |
@Override |
| 188 |
protected String buildValue_() { |
122 |
protected String buildValue_() { |
| 189 |
return this.subject.getColumnDefinition(); |
123 |
return this.subject.getColumnDefinition(); |
| 190 |
} |
124 |
} |
| 191 |
|
125 |
|
| 192 |
@Override |
126 |
@Override |
| 193 |
protected void setValue_(String value) { |
127 |
protected void setValue_(String value) { |
| 194 |
if (value.length() == 0) { |
128 |
if (value.length() == 0) { |
|
Lines 212-218
Link Here
|
| 212 |
} |
146 |
} |
| 213 |
}; |
147 |
}; |
| 214 |
} |
148 |
} |
| 215 |
|
149 |
|
| 216 |
private PropertyValueModel<String> buildInsertableStringHolder() { |
150 |
private PropertyValueModel<String> buildInsertableStringHolder() { |
| 217 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultInsertableHolder()) { |
151 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultInsertableHolder()) { |
| 218 |
@Override |
152 |
@Override |
|
Lines 228-237
Link Here
|
| 228 |
|
162 |
|
| 229 |
private PropertyValueModel<Boolean> buildDefaultInsertableHolder() { |
163 |
private PropertyValueModel<Boolean> buildDefaultInsertableHolder() { |
| 230 |
return new PropertyAspectAdapter<Column, Boolean>( |
164 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 231 |
getSubjectHolder(), |
165 |
getSubjectHolder(), |
| 232 |
BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, |
166 |
BaseColumn.SPECIFIED_INSERTABLE_PROPERTY, |
| 233 |
BaseColumn.DEFAULT_INSERTABLE_PROPERTY) |
167 |
BaseColumn.DEFAULT_INSERTABLE_PROPERTY) { |
| 234 |
{ |
168 |
|
| 235 |
@Override |
169 |
@Override |
| 236 |
protected Boolean buildValue_() { |
170 |
protected Boolean buildValue_() { |
| 237 |
if (this.subject.getSpecifiedInsertable() != null) { |
171 |
if (this.subject.getSpecifiedInsertable() != null) { |
|
Lines 241-264
Link Here
|
| 241 |
} |
175 |
} |
| 242 |
}; |
176 |
}; |
| 243 |
} |
177 |
} |
| 244 |
|
178 |
|
| 245 |
private WritablePropertyValueModel<Boolean> buildNullableHolder() { |
179 |
private WritablePropertyValueModel<Boolean> buildNullableHolder() { |
| 246 |
return new PropertyAspectAdapter<Column, Boolean>( |
180 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 247 |
getSubjectHolder(), |
181 |
getSubjectHolder(), |
| 248 |
BaseColumn.SPECIFIED_NULLABLE_PROPERTY) |
182 |
BaseColumn.SPECIFIED_NULLABLE_PROPERTY) { |
| 249 |
{ |
183 |
|
| 250 |
@Override |
184 |
@Override |
| 251 |
protected Boolean buildValue_() { |
185 |
protected Boolean buildValue_() { |
| 252 |
return this.subject.getSpecifiedNullable(); |
186 |
return this.subject.getSpecifiedNullable(); |
| 253 |
} |
187 |
} |
| 254 |
|
188 |
|
| 255 |
@Override |
189 |
@Override |
| 256 |
protected void setValue_(Boolean value) { |
190 |
protected void setValue_(Boolean value) { |
| 257 |
this.subject.setSpecifiedNullable(value); |
191 |
this.subject.setSpecifiedNullable(value); |
| 258 |
} |
192 |
} |
| 259 |
}; |
193 |
}; |
| 260 |
} |
194 |
} |
| 261 |
|
195 |
|
| 262 |
private PropertyValueModel<String> buildNullableStringHolder() { |
196 |
private PropertyValueModel<String> buildNullableStringHolder() { |
| 263 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultNullableHolder()) { |
197 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultNullableHolder()) { |
| 264 |
@Override |
198 |
@Override |
|
Lines 274-283
Link Here
|
| 274 |
|
208 |
|
| 275 |
private PropertyValueModel<Boolean> buildDefaultNullableHolder() { |
209 |
private PropertyValueModel<Boolean> buildDefaultNullableHolder() { |
| 276 |
return new PropertyAspectAdapter<Column, Boolean>( |
210 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 277 |
getSubjectHolder(), |
211 |
getSubjectHolder(), |
| 278 |
BaseColumn.SPECIFIED_NULLABLE_PROPERTY, |
212 |
BaseColumn.SPECIFIED_NULLABLE_PROPERTY, |
| 279 |
BaseColumn.DEFAULT_NULLABLE_PROPERTY) |
213 |
BaseColumn.DEFAULT_NULLABLE_PROPERTY) { |
| 280 |
{ |
214 |
|
| 281 |
@Override |
215 |
@Override |
| 282 |
protected Boolean buildValue_() { |
216 |
protected Boolean buildValue_() { |
| 283 |
if (this.subject.getSpecifiedNullable() != null) { |
217 |
if (this.subject.getSpecifiedNullable() != null) { |
|
Lines 287-355
Link Here
|
| 287 |
} |
221 |
} |
| 288 |
}; |
222 |
}; |
| 289 |
} |
223 |
} |
| 290 |
|
224 |
|
| 291 |
private Pane<Column> addTableCombo(Composite container) { |
225 |
private Pane<Column> addTableCombo(Composite container) { |
| 292 |
|
226 |
|
| 293 |
return new DatabaseObjectCombo<Column>(this, container) { |
227 |
return new DatabaseObjectCombo<Column>(this, container) { |
| 294 |
|
228 |
|
| 295 |
@Override |
229 |
@Override |
| 296 |
protected void addPropertyNames(Collection<String> propertyNames) { |
230 |
protected void addPropertyNames(Collection<String> propertyNames) { |
| 297 |
super.addPropertyNames(propertyNames); |
231 |
super.addPropertyNames(propertyNames); |
| 298 |
propertyNames.add(BaseColumn.DEFAULT_TABLE_PROPERTY); |
232 |
propertyNames.add(BaseColumn.DEFAULT_TABLE_PROPERTY); |
| 299 |
propertyNames.add(BaseColumn.SPECIFIED_TABLE_PROPERTY); |
233 |
propertyNames.add(BaseColumn.SPECIFIED_TABLE_PROPERTY); |
| 300 |
} |
234 |
} |
| 301 |
|
235 |
|
| 302 |
@Override |
236 |
@Override |
| 303 |
protected String getDefaultValue() { |
237 |
protected String getDefaultValue() { |
| 304 |
return this.getSubject().getDefaultTable(); |
238 |
return this.getSubject().getDefaultTable(); |
| 305 |
} |
239 |
} |
| 306 |
|
240 |
|
| 307 |
@Override |
241 |
@Override |
| 308 |
protected void setValue(String value) { |
242 |
protected void setValue(String value) { |
| 309 |
this.getSubject().setSpecifiedTable(value); |
243 |
this.getSubject().setSpecifiedTable(value); |
| 310 |
} |
244 |
} |
| 311 |
|
245 |
|
| 312 |
@Override |
246 |
@Override |
| 313 |
protected String getValue() { |
247 |
protected String getValue() { |
| 314 |
return this.getSubject().getSpecifiedTable(); |
248 |
return this.getSubject().getSpecifiedTable(); |
| 315 |
} |
249 |
} |
| 316 |
|
250 |
|
| 317 |
@Override |
251 |
@Override |
| 318 |
protected Iterable<String> getValues_() { |
252 |
protected Iterable<String> getValues_() { |
| 319 |
return CollectionTools.iterable(this.values()); |
253 |
return CollectionTools.iterable(this.values()); |
| 320 |
} |
254 |
} |
| 321 |
|
255 |
|
| 322 |
protected Iterator<String> values() { |
256 |
protected Iterator<String> values() { |
| 323 |
return this.getSubject().candidateTableNames(); |
257 |
return this.getSubject().candidateTableNames(); |
| 324 |
} |
258 |
} |
|
|
259 |
|
| 260 |
@Override |
| 261 |
protected String buildNullDefaultValueEntry() { |
| 262 |
return NLS.bind( |
| 263 |
JptUiDetailsMessages.DefaultWithOneParam, |
| 264 |
JptUiDetailsMessages.NoneSelected); |
| 265 |
} |
| 266 |
|
| 325 |
@Override |
267 |
@Override |
| 326 |
public String toString() { |
268 |
public String toString() { |
| 327 |
return "ColumnComposite.tableCombo"; //$NON-NLS-1$ |
269 |
return "ColumnComposite.tableCombo"; //$NON-NLS-1$ |
| 328 |
} |
270 |
} |
| 329 |
}; |
271 |
}; |
| 330 |
} |
272 |
} |
| 331 |
|
273 |
|
| 332 |
private WritablePropertyValueModel<Boolean> buildUniqueHolder() { |
274 |
private WritablePropertyValueModel<Boolean> buildUniqueHolder() { |
| 333 |
return new PropertyAspectAdapter<Column, Boolean>( |
275 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 334 |
getSubjectHolder(), |
276 |
getSubjectHolder(), |
| 335 |
BaseColumn.SPECIFIED_UNIQUE_PROPERTY) |
277 |
BaseColumn.SPECIFIED_UNIQUE_PROPERTY) { |
| 336 |
{ |
278 |
|
| 337 |
@Override |
279 |
@Override |
| 338 |
protected Boolean buildValue_() { |
280 |
protected Boolean buildValue_() { |
| 339 |
return this.subject.getSpecifiedUnique(); |
281 |
return this.subject.getSpecifiedUnique(); |
| 340 |
} |
282 |
} |
| 341 |
|
283 |
|
| 342 |
@Override |
284 |
@Override |
| 343 |
protected void setValue_(Boolean value) { |
285 |
protected void setValue_(Boolean value) { |
| 344 |
this.subject.setSpecifiedUnique(value); |
286 |
this.subject.setSpecifiedUnique(value); |
| 345 |
} |
287 |
} |
| 346 |
}; |
288 |
}; |
| 347 |
} |
289 |
} |
| 348 |
|
290 |
|
| 349 |
private PropertyValueModel<String> buildUniqueStringHolder() { |
291 |
private PropertyValueModel<String> buildUniqueStringHolder() { |
| 350 |
|
292 |
|
| 351 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultUniqueHolder()) { |
293 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultUniqueHolder()) { |
| 352 |
|
294 |
|
| 353 |
@Override |
295 |
@Override |
| 354 |
protected String transform(Boolean value) { |
296 |
protected String transform(Boolean value) { |
| 355 |
if (value != null) { |
297 |
if (value != null) { |
|
Lines 363-372
Link Here
|
| 363 |
|
305 |
|
| 364 |
private PropertyValueModel<Boolean> buildDefaultUniqueHolder() { |
306 |
private PropertyValueModel<Boolean> buildDefaultUniqueHolder() { |
| 365 |
return new PropertyAspectAdapter<Column, Boolean>( |
307 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 366 |
getSubjectHolder(), |
308 |
getSubjectHolder(), |
| 367 |
BaseColumn.SPECIFIED_UNIQUE_PROPERTY, |
309 |
BaseColumn.SPECIFIED_UNIQUE_PROPERTY, |
| 368 |
BaseColumn.DEFAULT_UNIQUE_PROPERTY) |
310 |
BaseColumn.DEFAULT_UNIQUE_PROPERTY) { |
| 369 |
{ |
311 |
|
| 370 |
@Override |
312 |
@Override |
| 371 |
protected Boolean buildValue_() { |
313 |
protected Boolean buildValue_() { |
| 372 |
if (this.subject.getSpecifiedUnique() != null) { |
314 |
if (this.subject.getSpecifiedUnique() != null) { |
|
Lines 376-404
Link Here
|
| 376 |
} |
318 |
} |
| 377 |
}; |
319 |
}; |
| 378 |
} |
320 |
} |
| 379 |
|
321 |
|
| 380 |
private WritablePropertyValueModel<Boolean> buildUpdatableHolder() { |
322 |
private WritablePropertyValueModel<Boolean> buildUpdatableHolder() { |
| 381 |
return new PropertyAspectAdapter<Column, Boolean>( |
323 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 382 |
getSubjectHolder(), |
324 |
getSubjectHolder(), |
| 383 |
BaseColumn.DEFAULT_UPDATABLE_PROPERTY, |
325 |
BaseColumn.DEFAULT_UPDATABLE_PROPERTY, |
| 384 |
BaseColumn.SPECIFIED_UPDATABLE_PROPERTY) |
326 |
BaseColumn.SPECIFIED_UPDATABLE_PROPERTY) { |
| 385 |
{ |
327 |
|
| 386 |
@Override |
328 |
@Override |
| 387 |
protected Boolean buildValue_() { |
329 |
protected Boolean buildValue_() { |
| 388 |
return this.subject.getSpecifiedUpdatable(); |
330 |
return this.subject.getSpecifiedUpdatable(); |
| 389 |
} |
331 |
} |
| 390 |
|
332 |
|
| 391 |
@Override |
333 |
@Override |
| 392 |
protected void setValue_(Boolean value) { |
334 |
protected void setValue_(Boolean value) { |
| 393 |
this.subject.setSpecifiedUpdatable(value); |
335 |
this.subject.setSpecifiedUpdatable(value); |
| 394 |
} |
336 |
} |
| 395 |
}; |
337 |
}; |
| 396 |
} |
338 |
} |
| 397 |
|
339 |
|
| 398 |
private PropertyValueModel<String> buildUpdatableStringHolder() { |
340 |
private PropertyValueModel<String> buildUpdatableStringHolder() { |
| 399 |
|
341 |
|
| 400 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultUpdatableHolder()) { |
342 |
return new TransformationPropertyValueModel<Boolean, String>(buildDefaultUpdatableHolder()) { |
| 401 |
|
343 |
|
| 402 |
@Override |
344 |
@Override |
| 403 |
protected String transform(Boolean value) { |
345 |
protected String transform(Boolean value) { |
| 404 |
if (value != null) { |
346 |
if (value != null) { |
|
Lines 412-421
Link Here
|
| 412 |
|
354 |
|
| 413 |
private PropertyValueModel<Boolean> buildDefaultUpdatableHolder() { |
355 |
private PropertyValueModel<Boolean> buildDefaultUpdatableHolder() { |
| 414 |
return new PropertyAspectAdapter<Column, Boolean>( |
356 |
return new PropertyAspectAdapter<Column, Boolean>( |
| 415 |
getSubjectHolder(), |
357 |
getSubjectHolder(), |
| 416 |
BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, |
358 |
BaseColumn.SPECIFIED_UPDATABLE_PROPERTY, |
| 417 |
BaseColumn.DEFAULT_UPDATABLE_PROPERTY) |
359 |
BaseColumn.DEFAULT_UPDATABLE_PROPERTY) { |
| 418 |
{ |
360 |
|
| 419 |
@Override |
361 |
@Override |
| 420 |
protected Boolean buildValue_() { |
362 |
protected Boolean buildValue_() { |
| 421 |
if (this.subject.getSpecifiedUpdatable() != null) { |
363 |
if (this.subject.getSpecifiedUpdatable() != null) { |
|
Lines 425-539
Link Here
|
| 425 |
} |
367 |
} |
| 426 |
}; |
368 |
}; |
| 427 |
} |
369 |
} |
| 428 |
|
370 |
|
| 429 |
@Override |
371 |
@Override |
| 430 |
protected void initializeLayout(Composite container) { |
372 |
protected void initializeLayout(Composite container) { |
| 431 |
|
|
|
| 432 |
// Column group pane |
373 |
// Column group pane |
| 433 |
container = addTitledGroup( |
374 |
container = addTitledGroup( |
| 434 |
container, |
375 |
container, |
| 435 |
JptUiDetailsMessages.ColumnComposite_columnSection |
376 |
JptUiDetailsMessages.ColumnComposite_columnSection); |
| 436 |
); |
377 |
|
| 437 |
|
|
|
| 438 |
// Column widgets |
378 |
// Column widgets |
| 439 |
addLabeledComposite( |
379 |
addLabeledComposite( |
| 440 |
container, |
380 |
container, |
| 441 |
JptUiDetailsMessages.ColumnComposite_name, |
381 |
JptUiDetailsMessages.ColumnComposite_name, |
| 442 |
addColumnCombo(container), |
382 |
addColumnCombo(container), |
| 443 |
JpaHelpContextIds.MAPPING_COLUMN |
383 |
JpaHelpContextIds.MAPPING_COLUMN); |
| 444 |
); |
384 |
|
| 445 |
|
|
|
| 446 |
// Table widgets |
385 |
// Table widgets |
| 447 |
addLabeledComposite( |
386 |
addLabeledComposite( |
| 448 |
container, |
387 |
container, |
| 449 |
JptUiDetailsMessages.ColumnComposite_table, |
388 |
JptUiDetailsMessages.ColumnComposite_table, |
| 450 |
addTableCombo(container), |
389 |
addTableCombo(container), |
| 451 |
JpaHelpContextIds.MAPPING_COLUMN_TABLE |
390 |
JpaHelpContextIds.MAPPING_COLUMN_TABLE); |
| 452 |
); |
391 |
|
| 453 |
|
|
|
| 454 |
// Details sub-pane |
392 |
// Details sub-pane |
| 455 |
container = addCollapsibleSubSection( |
393 |
container = addCollapsibleSubSection( |
| 456 |
container, |
394 |
container, |
| 457 |
JptUiDetailsMessages.ColumnComposite_details, |
395 |
JptUiDetailsMessages.ColumnComposite_details, |
| 458 |
new SimplePropertyValueModel<Boolean>(Boolean.FALSE) |
396 |
new SimplePropertyValueModel<Boolean>(Boolean.FALSE)); |
| 459 |
); |
397 |
|
| 460 |
|
|
|
| 461 |
new DetailsComposite(this, getSubjectHolder(), addSubPane(container, 0, 16)); |
398 |
new DetailsComposite(this, getSubjectHolder(), addSubPane(container, 0, 16)); |
| 462 |
} |
399 |
} |
| 463 |
|
400 |
|
| 464 |
protected class DetailsComposite extends Pane<Column> { |
401 |
protected class DetailsComposite extends Pane<Column> { |
| 465 |
|
402 |
|
| 466 |
public DetailsComposite(Pane<?> parentPane, |
403 |
public DetailsComposite( |
| 467 |
PropertyValueModel<? extends Column> subjectHolder, |
404 |
Pane<?> parentPane, |
| 468 |
Composite parent) { |
405 |
PropertyValueModel<? extends Column> subjectHolder, |
| 469 |
|
406 |
Composite parent) { |
|
|
407 |
|
| 470 |
super(parentPane, subjectHolder, parent, false); |
408 |
super(parentPane, subjectHolder, parent, false); |
| 471 |
} |
409 |
} |
| 472 |
|
410 |
|
| 473 |
@Override |
411 |
@Override |
| 474 |
protected void initializeLayout(Composite container) { |
412 |
protected void initializeLayout(Composite container) { |
| 475 |
|
|
|
| 476 |
// Insertable tri-state check box |
413 |
// Insertable tri-state check box |
| 477 |
addTriStateCheckBoxWithDefault( |
414 |
addTriStateCheckBoxWithDefault( |
| 478 |
addSubPane(container, 4), |
415 |
addSubPane(container, 4), |
| 479 |
JptUiDetailsMessages.ColumnComposite_insertable, |
416 |
JptUiDetailsMessages.ColumnComposite_insertable, |
| 480 |
buildInsertableHolder(), |
417 |
buildInsertableHolder(), |
| 481 |
buildInsertableStringHolder(), |
418 |
buildInsertableStringHolder(), |
| 482 |
JpaHelpContextIds.MAPPING_COLUMN_INSERTABLE |
419 |
JpaHelpContextIds.MAPPING_COLUMN_INSERTABLE); |
| 483 |
); |
420 |
|
| 484 |
|
|
|
| 485 |
// Updatable tri-state check box |
421 |
// Updatable tri-state check box |
| 486 |
addTriStateCheckBoxWithDefault( |
422 |
addTriStateCheckBoxWithDefault( |
| 487 |
container, |
423 |
container, |
| 488 |
JptUiDetailsMessages.ColumnComposite_updatable, |
424 |
JptUiDetailsMessages.ColumnComposite_updatable, |
| 489 |
buildUpdatableHolder(), |
425 |
buildUpdatableHolder(), |
| 490 |
buildUpdatableStringHolder(), |
426 |
buildUpdatableStringHolder(), |
| 491 |
JpaHelpContextIds.MAPPING_COLUMN_UPDATABLE |
427 |
JpaHelpContextIds.MAPPING_COLUMN_UPDATABLE); |
| 492 |
); |
428 |
|
| 493 |
|
|
|
| 494 |
// Unique tri-state check box |
429 |
// Unique tri-state check box |
| 495 |
addTriStateCheckBoxWithDefault( |
430 |
addTriStateCheckBoxWithDefault( |
| 496 |
container, |
431 |
container, |
| 497 |
JptUiDetailsMessages.ColumnComposite_unique, |
432 |
JptUiDetailsMessages.ColumnComposite_unique, |
| 498 |
buildUniqueHolder(), |
433 |
buildUniqueHolder(), |
| 499 |
buildUniqueStringHolder(), |
434 |
buildUniqueStringHolder(), |
| 500 |
JpaHelpContextIds.MAPPING_COLUMN_UNIQUE |
435 |
JpaHelpContextIds.MAPPING_COLUMN_UNIQUE); |
| 501 |
); |
436 |
|
| 502 |
|
|
|
| 503 |
// Nullable tri-state check box |
437 |
// Nullable tri-state check box |
| 504 |
addTriStateCheckBoxWithDefault( |
438 |
addTriStateCheckBoxWithDefault( |
| 505 |
container, |
439 |
container, |
| 506 |
JptUiDetailsMessages.ColumnComposite_nullable, |
440 |
JptUiDetailsMessages.ColumnComposite_nullable, |
| 507 |
buildNullableHolder(), |
441 |
buildNullableHolder(), |
| 508 |
buildNullableStringHolder(), |
442 |
buildNullableStringHolder(), |
| 509 |
JpaHelpContextIds.MAPPING_COLUMN_NULLABLE |
443 |
JpaHelpContextIds.MAPPING_COLUMN_NULLABLE); |
| 510 |
); |
444 |
|
| 511 |
|
|
|
| 512 |
addLengthCombo(container); |
445 |
addLengthCombo(container); |
| 513 |
addPrecisionCombo(container); |
446 |
addPrecisionCombo(container); |
| 514 |
addScaleCombo(container); |
447 |
addScaleCombo(container); |
| 515 |
|
448 |
|
| 516 |
// Column Definition widgets |
449 |
// Column Definition widgets |
| 517 |
addLabeledText( |
450 |
addLabeledText( |
| 518 |
container, |
451 |
container, |
| 519 |
JptUiDetailsMessages.ColumnComposite_columnDefinition, |
452 |
JptUiDetailsMessages.ColumnComposite_columnDefinition, |
| 520 |
buildColumnDefinitionHolder() |
453 |
buildColumnDefinitionHolder()); |
| 521 |
); |
|
|
| 522 |
} |
454 |
} |
| 523 |
|
455 |
|
| 524 |
private void addLengthCombo(Composite container) { |
456 |
private void addLengthCombo(Composite container) { |
| 525 |
new IntegerCombo<Column>(this, container) { |
457 |
new IntegerCombo<Column>(this, container) { |
| 526 |
|
|
|
| 527 |
@Override |
458 |
@Override |
| 528 |
protected String getLabelText() { |
459 |
protected String getLabelText() { |
| 529 |
return JptUiDetailsMessages.ColumnComposite_length; |
460 |
return JptUiDetailsMessages.ColumnComposite_length; |
| 530 |
} |
461 |
} |
| 531 |
|
462 |
|
| 532 |
@Override |
463 |
@Override |
| 533 |
protected String getHelpId() { |
464 |
protected String getHelpId() { |
| 534 |
return JpaHelpContextIds.MAPPING_COLUMN_LENGTH; |
465 |
return JpaHelpContextIds.MAPPING_COLUMN_LENGTH; |
| 535 |
} |
466 |
} |
| 536 |
|
467 |
|
| 537 |
@Override |
468 |
@Override |
| 538 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
469 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
| 539 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_LENGTH_PROPERTY) { |
470 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_LENGTH_PROPERTY) { |
|
Lines 551-557
Link Here
|
| 551 |
protected Integer buildValue_() { |
482 |
protected Integer buildValue_() { |
| 552 |
return this.subject.getSpecifiedLength(); |
483 |
return this.subject.getSpecifiedLength(); |
| 553 |
} |
484 |
} |
| 554 |
|
485 |
|
| 555 |
@Override |
486 |
@Override |
| 556 |
protected void setValue_(Integer value) { |
487 |
protected void setValue_(Integer value) { |
| 557 |
this.subject.setSpecifiedLength(value); |
488 |
this.subject.setSpecifiedLength(value); |
|
Lines 560-579
Link Here
|
| 560 |
} |
491 |
} |
| 561 |
}; |
492 |
}; |
| 562 |
} |
493 |
} |
| 563 |
|
494 |
|
| 564 |
private void addPrecisionCombo(Composite container) { |
495 |
private void addPrecisionCombo(Composite container) { |
| 565 |
new IntegerCombo<Column>(this, container) { |
496 |
new IntegerCombo<Column>(this, container) { |
| 566 |
|
|
|
| 567 |
@Override |
497 |
@Override |
| 568 |
protected String getLabelText() { |
498 |
protected String getLabelText() { |
| 569 |
return JptUiDetailsMessages.ColumnComposite_precision; |
499 |
return JptUiDetailsMessages.ColumnComposite_precision; |
| 570 |
} |
500 |
} |
| 571 |
|
501 |
|
| 572 |
@Override |
502 |
@Override |
| 573 |
protected String getHelpId() { |
503 |
protected String getHelpId() { |
| 574 |
return JpaHelpContextIds.MAPPING_COLUMN_PRECISION; |
504 |
return JpaHelpContextIds.MAPPING_COLUMN_PRECISION; |
| 575 |
} |
505 |
} |
| 576 |
|
506 |
|
| 577 |
@Override |
507 |
@Override |
| 578 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
508 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
| 579 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_PRECISION_PROPERTY) { |
509 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_PRECISION_PROPERTY) { |
|
Lines 591-597
Link Here
|
| 591 |
protected Integer buildValue_() { |
521 |
protected Integer buildValue_() { |
| 592 |
return this.subject.getSpecifiedPrecision(); |
522 |
return this.subject.getSpecifiedPrecision(); |
| 593 |
} |
523 |
} |
| 594 |
|
524 |
|
| 595 |
@Override |
525 |
@Override |
| 596 |
protected void setValue_(Integer value) { |
526 |
protected void setValue_(Integer value) { |
| 597 |
this.subject.setSpecifiedPrecision(value); |
527 |
this.subject.setSpecifiedPrecision(value); |
|
Lines 600-619
Link Here
|
| 600 |
} |
530 |
} |
| 601 |
}; |
531 |
}; |
| 602 |
} |
532 |
} |
| 603 |
|
533 |
|
| 604 |
private void addScaleCombo(Composite container) { |
534 |
private void addScaleCombo(Composite container) { |
| 605 |
new IntegerCombo<Column>(this, container) { |
535 |
new IntegerCombo<Column>(this, container) { |
| 606 |
|
|
|
| 607 |
@Override |
536 |
@Override |
| 608 |
protected String getLabelText() { |
537 |
protected String getLabelText() { |
| 609 |
return JptUiDetailsMessages.ColumnComposite_scale; |
538 |
return JptUiDetailsMessages.ColumnComposite_scale; |
| 610 |
} |
539 |
} |
| 611 |
|
540 |
|
| 612 |
@Override |
541 |
@Override |
| 613 |
protected String getHelpId() { |
542 |
protected String getHelpId() { |
| 614 |
return JpaHelpContextIds.MAPPING_COLUMN_SCALE; |
543 |
return JpaHelpContextIds.MAPPING_COLUMN_SCALE; |
| 615 |
} |
544 |
} |
| 616 |
|
545 |
|
| 617 |
@Override |
546 |
@Override |
| 618 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
547 |
protected PropertyValueModel<Integer> buildDefaultHolder() { |
| 619 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_SCALE_PROPERTY) { |
548 |
return new PropertyAspectAdapter<Column, Integer>(getSubjectHolder(), Column.DEFAULT_SCALE_PROPERTY) { |
|
Lines 631-637
Link Here
|
| 631 |
protected Integer buildValue_() { |
560 |
protected Integer buildValue_() { |
| 632 |
return this.subject.getSpecifiedScale(); |
561 |
return this.subject.getSpecifiedScale(); |
| 633 |
} |
562 |
} |
| 634 |
|
563 |
|
| 635 |
@Override |
564 |
@Override |
| 636 |
protected void setValue_(Integer value) { |
565 |
protected void setValue_(Integer value) { |
| 637 |
this.subject.setSpecifiedScale(value); |
566 |
this.subject.setSpecifiedScale(value); |
|
Lines 641-644
Link Here
|
| 641 |
}; |
570 |
}; |
| 642 |
} |
571 |
} |
| 643 |
} |
572 |
} |
| 644 |
} |
573 |
} |