1
|
/**
|
2
|
* Copyright (C) 2015 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.vaadin.component.taxon;
|
10
|
|
11
|
import java.sql.SQLException;
|
12
|
import java.util.Arrays;
|
13
|
import java.util.Map;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import com.vaadin.annotations.AutoGenerated;
|
17
|
import com.vaadin.data.Container.Hierarchical;
|
18
|
import com.vaadin.data.Validator.EmptyValueException;
|
19
|
import com.vaadin.data.util.sqlcontainer.RowId;
|
20
|
import com.vaadin.event.Transferable;
|
21
|
import com.vaadin.event.dd.DragAndDropEvent;
|
22
|
import com.vaadin.event.dd.DropHandler;
|
23
|
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
|
24
|
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
|
25
|
import com.vaadin.server.FontAwesome;
|
26
|
import com.vaadin.server.Page;
|
27
|
import com.vaadin.shared.ui.label.ContentMode;
|
28
|
import com.vaadin.ui.Alignment;
|
29
|
import com.vaadin.ui.Button;
|
30
|
import com.vaadin.ui.Button.ClickEvent;
|
31
|
import com.vaadin.ui.Button.ClickListener;
|
32
|
import com.vaadin.ui.ComboBox;
|
33
|
import com.vaadin.ui.Component;
|
34
|
import com.vaadin.ui.CustomComponent;
|
35
|
import com.vaadin.ui.DragAndDropWrapper;
|
36
|
import com.vaadin.ui.HorizontalLayout;
|
37
|
import com.vaadin.ui.Label;
|
38
|
import com.vaadin.ui.Notification;
|
39
|
import com.vaadin.ui.Notification.Type;
|
40
|
import com.vaadin.ui.TextField;
|
41
|
import com.vaadin.ui.TreeTable;
|
42
|
import com.vaadin.ui.UI;
|
43
|
import com.vaadin.ui.VerticalLayout;
|
44
|
import com.vaadin.ui.Window;
|
45
|
|
46
|
import eu.etaxonomy.cdm.vaadin.component.CdmProgressComponent;
|
47
|
import eu.etaxonomy.cdm.vaadin.component.TextFieldNFix;
|
48
|
import eu.etaxonomy.cdm.vaadin.container.IdUuidName;
|
49
|
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer;
|
50
|
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree.Direction;
|
51
|
import eu.etaxonomy.cdm.vaadin.session.BasicEvent;
|
52
|
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent;
|
53
|
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action;
|
54
|
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation;
|
55
|
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities;
|
56
|
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities;
|
57
|
;
|
58
|
|
59
|
/**
|
60
|
* @author cmathew
|
61
|
* @date 13 Apr 2015
|
62
|
*
|
63
|
*/
|
64
|
public class EditConceptRelationshipComposite extends CustomComponent {
|
65
|
|
66
|
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
|
67
|
|
68
|
@AutoGenerated
|
69
|
private VerticalLayout mainLayout;
|
70
|
@AutoGenerated
|
71
|
private CdmProgressComponent cdmProgressComponent;
|
72
|
@AutoGenerated
|
73
|
private HorizontalLayout saveCancelHLayout;
|
74
|
@AutoGenerated
|
75
|
private Button cancelButton;
|
76
|
@AutoGenerated
|
77
|
private Button saveButton;
|
78
|
@AutoGenerated
|
79
|
private HorizontalLayout horizontalLayout;
|
80
|
@AutoGenerated
|
81
|
private Label rightLabel;
|
82
|
@AutoGenerated
|
83
|
private VerticalLayout typeVLayout;
|
84
|
@AutoGenerated
|
85
|
private ComboBox conceptRComboBox;
|
86
|
@AutoGenerated
|
87
|
private Label typeLabel;
|
88
|
@AutoGenerated
|
89
|
private Label leftLabel;
|
90
|
private TextField leftTaxonTextField, rightTaxonTextField;
|
91
|
|
92
|
private Component leftTaxonComponent, rightTaxonComponent;
|
93
|
private TextField fromTaxonTextField, toTaxonTextField;
|
94
|
private Label leftTaxonLabel, rightTaxonLabel;
|
95
|
|
96
|
|
97
|
private final EditConceptRelationshipPresenter presenter;
|
98
|
|
99
|
private IdUuidName fromTaxonIun, taxonRTypeIun, toTaxonIun;
|
100
|
private UUID relUuid;
|
101
|
private Window window;
|
102
|
|
103
|
private final static String CHOOSE_TREL_TYPE = "Choose Type ...";
|
104
|
private final static String DRAG_TAXON_HINT = "Drag Taxon here ...";
|
105
|
|
106
|
|
107
|
private Action action;
|
108
|
private Direction direction;
|
109
|
|
110
|
public EditConceptRelationshipComposite(IdUuidName fromTaxonIdUuidName,
|
111
|
IdUuidName taxonRTypeIdUuidName,
|
112
|
IdUuidName toTaxonIdUuidName,
|
113
|
Action action,
|
114
|
Direction direction) {
|
115
|
this(direction);
|
116
|
|
117
|
init(fromTaxonIdUuidName, taxonRTypeIdUuidName, toTaxonIdUuidName, action);
|
118
|
|
119
|
}
|
120
|
|
121
|
public EditConceptRelationshipComposite(IdUuidName fromTaxonIun,
|
122
|
UUID relUuid,
|
123
|
Action action,
|
124
|
Direction direction) {
|
125
|
this(direction);
|
126
|
this.relUuid = relUuid;
|
127
|
|
128
|
Map<String, IdUuidName> map = presenter.getRelTypeToTaxonIunMap(fromTaxonIun.getUuid(), relUuid);
|
129
|
taxonRTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY);
|
130
|
toTaxonIun = map.get(EditConceptRelationshipPresenter.TO_TAXON_KEY);
|
131
|
init(fromTaxonIun, taxonRTypeIun, toTaxonIun, action);
|
132
|
|
133
|
}
|
134
|
|
135
|
|
136
|
/**
|
137
|
* The constructor should first build the main layout, set the
|
138
|
* composition root and then do any custom initialization.
|
139
|
*
|
140
|
* The constructor will not be automatically regenerated by the
|
141
|
* visual editor.
|
142
|
*/
|
143
|
private EditConceptRelationshipComposite(Direction direction) {
|
144
|
this.direction = direction;
|
145
|
|
146
|
buildMainLayout();
|
147
|
initDirectionComponents();
|
148
|
setCompositionRoot(mainLayout);
|
149
|
|
150
|
this.presenter = new EditConceptRelationshipPresenter();
|
151
|
addUIListeners();
|
152
|
}
|
153
|
|
154
|
|
155
|
public void init(IdUuidName fromTaxonIdUuidName,
|
156
|
IdUuidName taxonRTypeIdUuidName,
|
157
|
IdUuidName toTaxonIdUuidName,
|
158
|
Action action) {
|
159
|
|
160
|
this.fromTaxonIun = fromTaxonIdUuidName;
|
161
|
this.taxonRTypeIun = taxonRTypeIdUuidName;
|
162
|
this.toTaxonIun = toTaxonIdUuidName;
|
163
|
this.action = action;
|
164
|
|
165
|
initFromTaxon();
|
166
|
initConceptRComboBox();
|
167
|
}
|
168
|
|
169
|
public void setWindow(Window window) {
|
170
|
this.window = window;
|
171
|
}
|
172
|
|
173
|
public boolean canCreateRelationship() {
|
174
|
return presenter.canCreateRelationship(fromTaxonIun.getUuid());
|
175
|
}
|
176
|
|
177
|
private void initFromTaxon() {
|
178
|
if(fromTaxonIun != null) {
|
179
|
fromTaxonTextField.setReadOnly(false);
|
180
|
fromTaxonTextField.setValue(fromTaxonIun.getName());
|
181
|
fromTaxonTextField.setReadOnly(true);
|
182
|
}
|
183
|
if(toTaxonIun != null) {
|
184
|
toTaxonTextField.setReadOnly(false);
|
185
|
toTaxonTextField.setValue(toTaxonIun.getName());
|
186
|
toTaxonTextField.setReadOnly(true);
|
187
|
}
|
188
|
}
|
189
|
|
190
|
private void initDirectionComponents() {
|
191
|
|
192
|
initTaxonComponents();
|
193
|
|
194
|
leftLabel.addStyleName("cr-arrow");
|
195
|
leftLabel.setContentMode(ContentMode.HTML);
|
196
|
|
197
|
rightLabel.addStyleName("cr-arrow");
|
198
|
rightLabel.setContentMode(ContentMode.HTML);
|
199
|
|
200
|
rightTaxonTextField.setReadOnly(false);
|
201
|
leftTaxonTextField.setReadOnly(false);
|
202
|
switch(direction) {
|
203
|
case LEFT_RIGHT:
|
204
|
leftLabel.setValue(FontAwesome.CARET_RIGHT.getHtml());
|
205
|
rightLabel.setValue(FontAwesome.CARET_RIGHT.getHtml());
|
206
|
leftTaxonLabel.setValue("From Taxon");
|
207
|
rightTaxonLabel.setValue("To Taxon");
|
208
|
fromTaxonTextField = leftTaxonTextField;
|
209
|
toTaxonTextField = rightTaxonTextField;
|
210
|
rightTaxonTextField.setValue(DRAG_TAXON_HINT);
|
211
|
rightTaxonComponent = intiDragDropWrapper(rightTaxonComponent, rightTaxonTextField);
|
212
|
break;
|
213
|
case RIGHT_LEFT:
|
214
|
leftLabel.setValue(FontAwesome.CARET_LEFT.getHtml());
|
215
|
rightLabel.setValue(FontAwesome.CARET_LEFT.getHtml());
|
216
|
leftTaxonLabel.setValue("To Taxon");
|
217
|
rightTaxonLabel.setValue("From Taxon");
|
218
|
leftTaxonTextField.setValue(DRAG_TAXON_HINT);
|
219
|
fromTaxonTextField = rightTaxonTextField;
|
220
|
toTaxonTextField = leftTaxonTextField;
|
221
|
leftTaxonComponent = intiDragDropWrapper(leftTaxonComponent, leftTaxonTextField);
|
222
|
break;
|
223
|
}
|
224
|
|
225
|
rightTaxonTextField.setReadOnly(true);
|
226
|
leftTaxonTextField.setReadOnly(true);
|
227
|
|
228
|
horizontalLayout.addComponent(leftTaxonComponent,0);
|
229
|
horizontalLayout.setComponentAlignment(leftTaxonComponent, new Alignment(48));
|
230
|
|
231
|
|
232
|
horizontalLayout.addComponent(rightTaxonComponent);
|
233
|
horizontalLayout.setComponentAlignment(rightTaxonComponent, new Alignment(48));
|
234
|
|
235
|
leftLabel.setSizeUndefined();
|
236
|
rightLabel.setSizeUndefined();
|
237
|
|
238
|
}
|
239
|
|
240
|
private void initConceptRComboBox() {
|
241
|
conceptRComboBox.setImmediate(true);
|
242
|
conceptRComboBox.setItemCaptionPropertyId("titleCache");
|
243
|
try {
|
244
|
conceptRComboBox.setContainerDataSource(presenter.loadTaxonRelationshipTypeContainer());
|
245
|
} catch (SQLException e) {
|
246
|
// TODO Auto-generated catch block
|
247
|
e.printStackTrace();
|
248
|
}
|
249
|
if(taxonRTypeIun == null) {
|
250
|
conceptRComboBox.setInputPrompt(CHOOSE_TREL_TYPE);
|
251
|
} else {
|
252
|
conceptRComboBox.setValue(new RowId(taxonRTypeIun.getId()));
|
253
|
}
|
254
|
|
255
|
if(action == Action.Delete) {
|
256
|
conceptRComboBox.setReadOnly(true);
|
257
|
saveButton.setCaption("ok");
|
258
|
}
|
259
|
}
|
260
|
|
261
|
private void initTaxonComponents() {
|
262
|
// init left taxon layout
|
263
|
leftTaxonLabel = new Label();
|
264
|
leftTaxonTextField = new TextFieldNFix();
|
265
|
leftTaxonComponent = buildTaxonVLayout(leftTaxonLabel, leftTaxonTextField);
|
266
|
|
267
|
// init right taxon layout
|
268
|
rightTaxonLabel = new Label();
|
269
|
rightTaxonTextField = new TextFieldNFix();
|
270
|
rightTaxonComponent = buildTaxonVLayout(rightTaxonLabel, rightTaxonTextField);
|
271
|
}
|
272
|
|
273
|
private DragAndDropWrapper intiDragDropWrapper(Component toTaxonLayout, final TextField toTaxonTextField) {
|
274
|
|
275
|
DragAndDropWrapper toTaxonLayoutWrapper = new DragAndDropWrapper(toTaxonLayout);
|
276
|
toTaxonLayoutWrapper.setImmediate(false);
|
277
|
toTaxonLayoutWrapper.setWidth("-1px");
|
278
|
toTaxonLayoutWrapper.setHeight("-1px");
|
279
|
|
280
|
toTaxonLayoutWrapper.setDropHandler(new DropHandler() {
|
281
|
|
282
|
@Override
|
283
|
public AcceptCriterion getAcceptCriterion() {
|
284
|
return AcceptAll.get();
|
285
|
}
|
286
|
|
287
|
@Override
|
288
|
public void drop(DragAndDropEvent event) {
|
289
|
// Wrapper for the object that is dragged
|
290
|
Transferable t = event.getTransferable();
|
291
|
|
292
|
// Make sure the drag source is a status composite tree table
|
293
|
if (action != Action.Delete && t.getSourceComponent() instanceof TreeTable) {
|
294
|
TreeTable table = (TreeTable)t.getSourceComponent();
|
295
|
Hierarchical containerDataSource = table.getContainerDataSource();
|
296
|
if(containerDataSource instanceof LeafNodeTaxonContainer) {
|
297
|
LeafNodeTaxonContainer lntc = (LeafNodeTaxonContainer)containerDataSource;
|
298
|
Object sourceItemId = t.getData("itemId");
|
299
|
String toName = (String)lntc.getProperty(sourceItemId, LeafNodeTaxonContainer.NAME_ID).getValue();
|
300
|
toTaxonIun = new IdUuidName(sourceItemId,
|
301
|
lntc.getUuid(sourceItemId),
|
302
|
toName);
|
303
|
toTaxonTextField.setReadOnly(false);
|
304
|
toTaxonTextField.setValue(toName);
|
305
|
toTaxonTextField.setReadOnly(true);
|
306
|
}
|
307
|
}
|
308
|
}
|
309
|
});
|
310
|
return toTaxonLayoutWrapper;
|
311
|
|
312
|
}
|
313
|
|
314
|
|
315
|
private void addUIListeners() {
|
316
|
addSaveButtonListener();
|
317
|
addCancelButtonListener();
|
318
|
|
319
|
}
|
320
|
|
321
|
private void addSaveButtonListener() {
|
322
|
saveButton.addClickListener(new ClickListener() {
|
323
|
|
324
|
@Override
|
325
|
public void buttonClick(ClickEvent event) {
|
326
|
|
327
|
|
328
|
try {
|
329
|
conceptRComboBox.validate();
|
330
|
rightTaxonTextField.validate();
|
331
|
if(toTaxonIun == null) {
|
332
|
// FIXME: Not efficient - figure out a way
|
333
|
// of validation including the null check
|
334
|
throw new EmptyValueException("");
|
335
|
}
|
336
|
} catch (EmptyValueException e) {
|
337
|
Notification notification = new Notification("Invalid input", "Neither Relationship Type nor To Taxon can be empty", Type.WARNING_MESSAGE);
|
338
|
notification.setDelayMsec(2000);
|
339
|
notification.show(Page.getCurrent());
|
340
|
return;
|
341
|
}
|
342
|
|
343
|
CdmVaadinUtilities.setEnabled(mainLayout, false, null);
|
344
|
|
345
|
try {
|
346
|
CdmVaadinUtilities.exec(new CdmVaadinOperation(1000, cdmProgressComponent) {
|
347
|
@Override
|
348
|
public boolean execute() {
|
349
|
UUID relTypeUuid = presenter.getTaxonRTypeContainer().getUuid(conceptRComboBox.getValue());
|
350
|
switch(action) {
|
351
|
case Create:
|
352
|
setProgress("Saving New Concept Relationship");
|
353
|
presenter.createRelationship(fromTaxonIun.getUuid(), relTypeUuid, toTaxonIun.getUuid());
|
354
|
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
|
355
|
break;
|
356
|
case Update:
|
357
|
setProgress("Update Concept Relationship");
|
358
|
presenter.updateRelationship(fromTaxonIun.getUuid(), relUuid, relTypeUuid, toTaxonIun.getUuid());
|
359
|
registerDelayedEvent(new CdmChangeEvent(Action.Update, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
|
360
|
break;
|
361
|
case Delete:
|
362
|
setProgress("Deleting Concept Relationship");
|
363
|
presenter.deleteRelationship(fromTaxonIun.getUuid(), relUuid);
|
364
|
registerDelayedEvent(new CdmChangeEvent(Action.Delete, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
|
365
|
break;
|
366
|
default:
|
367
|
|
368
|
}
|
369
|
return true;
|
370
|
}
|
371
|
|
372
|
@Override
|
373
|
public void postOpUIUpdate(boolean success) {
|
374
|
if(success) {
|
375
|
if(window != null) {
|
376
|
UI.getCurrent().removeWindow(window);
|
377
|
}
|
378
|
} else {
|
379
|
CdmVaadinUtilities.setEnabled(mainLayout, true, null);
|
380
|
}
|
381
|
}
|
382
|
});
|
383
|
} finally {
|
384
|
CdmVaadinSessionUtilities.getCurrentBasicEventService()
|
385
|
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), false);
|
386
|
}
|
387
|
}
|
388
|
});
|
389
|
}
|
390
|
|
391
|
private void addCancelButtonListener() {
|
392
|
cancelButton.addClickListener(new ClickListener() {
|
393
|
|
394
|
@Override
|
395
|
public void buttonClick(ClickEvent event) {
|
396
|
if(window != null) {
|
397
|
UI.getCurrent().removeWindow(window);
|
398
|
}
|
399
|
CdmVaadinSessionUtilities.getCurrentBasicEventService()
|
400
|
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), true);
|
401
|
}
|
402
|
});
|
403
|
}
|
404
|
|
405
|
|
406
|
private static void showInDialog(String windowTitle,
|
407
|
EditConceptRelationshipComposite ecrc) {
|
408
|
//FIXME : hack for the moment to demonstrate checking of concept relationship rules
|
409
|
if(ecrc.action.equals(Action.Create) && !ecrc.canCreateRelationship()) {
|
410
|
Notification.show("Cannot create relationship for a taxon which is already congruent to another taxon", Type.WARNING_MESSAGE);
|
411
|
return;
|
412
|
}
|
413
|
Window dialog = new Window(windowTitle);
|
414
|
dialog.setModal(false);
|
415
|
dialog.setClosable(false);
|
416
|
dialog.setResizable(false);
|
417
|
UI.getCurrent().addWindow(dialog);
|
418
|
ecrc.setWindow(dialog);
|
419
|
dialog.setContent(ecrc);
|
420
|
CdmVaadinSessionUtilities.getCurrentBasicEventService()
|
421
|
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_START_ID, ConceptRelationshipComposite.class), false);
|
422
|
}
|
423
|
|
424
|
public static void showInDialog(String windowTitle,
|
425
|
IdUuidName fromTaxonIun,
|
426
|
IdUuidName taxonRTypeIun,
|
427
|
IdUuidName toTaxonIun,
|
428
|
Action action,
|
429
|
Direction direction) {
|
430
|
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action, direction);
|
431
|
showInDialog(windowTitle, ecrc);
|
432
|
}
|
433
|
|
434
|
public static void showInDialog(String windowTitle,
|
435
|
IdUuidName fromTaxonIun,
|
436
|
UUID relUuid,
|
437
|
Action action,
|
438
|
Direction direction) {
|
439
|
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, relUuid, action, direction);
|
440
|
showInDialog(windowTitle, ecrc);
|
441
|
}
|
442
|
|
443
|
|
444
|
private VerticalLayout buildTaxonVLayout(Label taxonDirLabel, TextField taxonTextField) {
|
445
|
// common part: create layout
|
446
|
VerticalLayout vLayout = new VerticalLayout();
|
447
|
vLayout.setImmediate(false);
|
448
|
vLayout.setWidth("-1px");
|
449
|
vLayout.setHeight("-1px");
|
450
|
vLayout.setMargin(false);
|
451
|
vLayout.setSpacing(true);
|
452
|
|
453
|
|
454
|
taxonDirLabel.setImmediate(false);
|
455
|
taxonDirLabel.setWidth("-1px");
|
456
|
taxonDirLabel.setHeight("-1px");
|
457
|
|
458
|
vLayout.addComponent(taxonDirLabel);
|
459
|
vLayout.setComponentAlignment(taxonDirLabel, new Alignment(48));
|
460
|
|
461
|
|
462
|
taxonTextField.setImmediate(false);
|
463
|
taxonTextField.setWidth("-1px");
|
464
|
taxonTextField.setHeight("-1px");
|
465
|
taxonTextField.setInvalidAllowed(false);
|
466
|
taxonTextField.setRequired(true);
|
467
|
taxonTextField.setReadOnly(true);
|
468
|
vLayout.addComponent(taxonTextField);
|
469
|
vLayout.setComponentAlignment(taxonTextField, new Alignment(48));
|
470
|
|
471
|
return vLayout;
|
472
|
}
|
473
|
|
474
|
@AutoGenerated
|
475
|
private VerticalLayout buildMainLayout() {
|
476
|
// common part: create layout
|
477
|
mainLayout = new VerticalLayout();
|
478
|
mainLayout.setImmediate(false);
|
479
|
mainLayout.setWidth("740px");
|
480
|
mainLayout.setHeight("170px");
|
481
|
mainLayout.setMargin(false);
|
482
|
mainLayout.setSpacing(true);
|
483
|
|
484
|
// top-level component properties
|
485
|
setWidth("740px");
|
486
|
setHeight("170px");
|
487
|
|
488
|
// horizontalLayout
|
489
|
horizontalLayout = buildHorizontalLayout();
|
490
|
mainLayout.addComponent(horizontalLayout);
|
491
|
mainLayout.setExpandRatio(horizontalLayout, 1.0f);
|
492
|
mainLayout.setComponentAlignment(horizontalLayout, new Alignment(48));
|
493
|
|
494
|
// saveCancelHLayout
|
495
|
saveCancelHLayout = buildSaveCancelHLayout();
|
496
|
mainLayout.addComponent(saveCancelHLayout);
|
497
|
mainLayout.setComponentAlignment(saveCancelHLayout, new Alignment(48));
|
498
|
|
499
|
// cdmProgressComponent
|
500
|
cdmProgressComponent = new CdmProgressComponent();
|
501
|
cdmProgressComponent.setImmediate(false);
|
502
|
cdmProgressComponent.setWidth("-1px");
|
503
|
cdmProgressComponent.setHeight("-1px");
|
504
|
mainLayout.addComponent(cdmProgressComponent);
|
505
|
mainLayout.setComponentAlignment(cdmProgressComponent, new Alignment(48));
|
506
|
|
507
|
return mainLayout;
|
508
|
}
|
509
|
|
510
|
@AutoGenerated
|
511
|
private HorizontalLayout buildHorizontalLayout() {
|
512
|
// common part: create layout
|
513
|
horizontalLayout = new HorizontalLayout();
|
514
|
horizontalLayout.setImmediate(false);
|
515
|
horizontalLayout.setWidth("-1px");
|
516
|
horizontalLayout.setHeight("-1px");
|
517
|
horizontalLayout.setMargin(true);
|
518
|
horizontalLayout.setSpacing(true);
|
519
|
|
520
|
// leftLabel
|
521
|
leftLabel = new Label();
|
522
|
leftLabel.setImmediate(false);
|
523
|
leftLabel.setWidth("-1px");
|
524
|
leftLabel.setHeight("30px");
|
525
|
leftLabel.setValue("Label");
|
526
|
horizontalLayout.addComponent(leftLabel);
|
527
|
horizontalLayout.setComponentAlignment(leftLabel, new Alignment(24));
|
528
|
|
529
|
// typeVLayout
|
530
|
typeVLayout = buildTypeVLayout();
|
531
|
horizontalLayout.addComponent(typeVLayout);
|
532
|
horizontalLayout.setExpandRatio(typeVLayout, 1.0f);
|
533
|
horizontalLayout.setComponentAlignment(typeVLayout, new Alignment(48));
|
534
|
|
535
|
// rightLabel
|
536
|
rightLabel = new Label();
|
537
|
rightLabel.setImmediate(false);
|
538
|
rightLabel.setWidth("-1px");
|
539
|
rightLabel.setHeight("30px");
|
540
|
rightLabel.setValue("Label");
|
541
|
horizontalLayout.addComponent(rightLabel);
|
542
|
horizontalLayout.setComponentAlignment(rightLabel, new Alignment(24));
|
543
|
|
544
|
return horizontalLayout;
|
545
|
}
|
546
|
|
547
|
@AutoGenerated
|
548
|
private VerticalLayout buildTypeVLayout() {
|
549
|
// common part: create layout
|
550
|
typeVLayout = new VerticalLayout();
|
551
|
typeVLayout.setImmediate(false);
|
552
|
typeVLayout.setWidth("-1px");
|
553
|
typeVLayout.setHeight("-1px");
|
554
|
typeVLayout.setMargin(false);
|
555
|
typeVLayout.setSpacing(true);
|
556
|
|
557
|
// typeLabel
|
558
|
typeLabel = new Label();
|
559
|
typeLabel.setImmediate(false);
|
560
|
typeLabel.setWidth("-1px");
|
561
|
typeLabel.setHeight("-1px");
|
562
|
typeLabel.setValue("Type");
|
563
|
typeVLayout.addComponent(typeLabel);
|
564
|
typeVLayout.setComponentAlignment(typeLabel, new Alignment(48));
|
565
|
|
566
|
// conceptRComboBox
|
567
|
conceptRComboBox = new ComboBox();
|
568
|
conceptRComboBox.setImmediate(false);
|
569
|
conceptRComboBox.setWidth("260px");
|
570
|
conceptRComboBox.setHeight("-1px");
|
571
|
conceptRComboBox.setRequired(true);
|
572
|
typeVLayout.addComponent(conceptRComboBox);
|
573
|
typeVLayout.setExpandRatio(conceptRComboBox, 1.0f);
|
574
|
typeVLayout.setComponentAlignment(conceptRComboBox, new Alignment(48));
|
575
|
|
576
|
return typeVLayout;
|
577
|
}
|
578
|
|
579
|
@AutoGenerated
|
580
|
private HorizontalLayout buildSaveCancelHLayout() {
|
581
|
// common part: create layout
|
582
|
saveCancelHLayout = new HorizontalLayout();
|
583
|
saveCancelHLayout.setImmediate(false);
|
584
|
saveCancelHLayout.setWidth("-1px");
|
585
|
saveCancelHLayout.setHeight("-1px");
|
586
|
saveCancelHLayout.setMargin(false);
|
587
|
saveCancelHLayout.setSpacing(true);
|
588
|
|
589
|
// saveButton
|
590
|
saveButton = new Button();
|
591
|
saveButton.setCaption("save");
|
592
|
saveButton.setImmediate(true);
|
593
|
saveButton.setWidth("-1px");
|
594
|
saveButton.setHeight("-1px");
|
595
|
saveCancelHLayout.addComponent(saveButton);
|
596
|
|
597
|
// cancelButton
|
598
|
cancelButton = new Button();
|
599
|
cancelButton.setCaption("cancel");
|
600
|
cancelButton.setImmediate(true);
|
601
|
cancelButton.setWidth("-1px");
|
602
|
cancelButton.setHeight("-1px");
|
603
|
saveCancelHLayout.addComponent(cancelButton);
|
604
|
|
605
|
return saveCancelHLayout;
|
606
|
}
|
607
|
|
608
|
}
|