Project

General

Profile

Download (22 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2015 EDIT
4
 * European Distributed Institute of Taxonomy
5
 * http://www.e-taxonomy.eu
6
 *
7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8
 * See LICENSE.TXT at the top of this package for the full license terms.
9
 */
10
package eu.etaxonomy.cdm.vaadin.component;
11

    
12
import java.sql.SQLException;
13
import java.util.Arrays;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
import com.vaadin.annotations.AutoGenerated;
18
import com.vaadin.data.Container.Hierarchical;
19
import com.vaadin.data.Validator.EmptyValueException;
20
import com.vaadin.data.util.sqlcontainer.RowId;
21
import com.vaadin.event.Transferable;
22
import com.vaadin.event.dd.DragAndDropEvent;
23
import com.vaadin.event.dd.DropHandler;
24
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
25
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
26
import com.vaadin.server.FontAwesome;
27
import com.vaadin.server.Page;
28
import com.vaadin.shared.ui.label.ContentMode;
29
import com.vaadin.ui.Alignment;
30
import com.vaadin.ui.Button;
31
import com.vaadin.ui.Button.ClickEvent;
32
import com.vaadin.ui.Button.ClickListener;
33
import com.vaadin.ui.ComboBox;
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.container.IdUuidName;
47
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer;
48
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree.Direction;
49
import eu.etaxonomy.cdm.vaadin.presenter.EditConceptRelationshipPresenter;
50
import eu.etaxonomy.cdm.vaadin.session.BasicEvent;
51
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent;
52
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action;
53
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation;
54
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities;
55
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities;
56

    
57
/**
58
 * @author cmathew
59
 * @date 13 Apr 2015
60
 *
61
 */
62
public class EditConceptRelationshipComposite extends CustomComponent {
63

    
64
    /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
65

    
66
    @AutoGenerated
67
    private VerticalLayout mainLayout;
68
    @AutoGenerated
69
    private CdmProgressComponent cdmProgressComponent;
70
    @AutoGenerated
71
    private HorizontalLayout saveCancelHLayout;
72
    @AutoGenerated
73
    private Button cancelButton;
74
    @AutoGenerated
75
    private Button saveButton;
76
    @AutoGenerated
77
    private HorizontalLayout horizontalLayout;
78
    @AutoGenerated
79
    private Label rightLabel;
80
    @AutoGenerated
81
    private VerticalLayout typeVLayout;
82
    @AutoGenerated
83
    private ComboBox conceptRComboBox;
84
    @AutoGenerated
85
    private Label typeLabel;
86
    @AutoGenerated
87
    private Label leftLabel;
88
    @AutoGenerated
89
    private VerticalLayout fromTaxonVLayout;
90
    @AutoGenerated
91
    private Label fromTaxonValue;
92
    @AutoGenerated
93
    private Label fromTaxonLabel;
94
    private VerticalLayout toTaxonVLayout;
95
    private Label toTaxonLabeL;
96
    private TextField toTaxonTextField;
97
    private DragAndDropWrapper toTaxonLayoutWrapper;
98

    
99
    private final EditConceptRelationshipPresenter presenter;
100

    
101
    private IdUuidName fromTaxonIun, taxonRTypeIun, toTaxonIun;
102
    private UUID relUuid;
103
    private Window window;
104

    
105
    private final static String CHOOSE_TREL_TYPE = "Choose Type ...";
106
    private final static String DRAG_TAXON_HINT = "Drag Taxon here ...";
107

    
108

    
109
    private Action action;
110
    private Direction direction;
111

    
112
    public EditConceptRelationshipComposite(IdUuidName fromTaxonIdUuidName,
113
            IdUuidName taxonRTypeIdUuidName,
114
            IdUuidName toTaxonIdUuidName,
115
            Action action,
116
            Direction direction) {
117
        this();
118
        this.direction = direction;
119
        init(fromTaxonIdUuidName, taxonRTypeIdUuidName, toTaxonIdUuidName, action);
120

    
121
    }
122

    
123
    public EditConceptRelationshipComposite(IdUuidName fromTaxonIun,
124
            UUID relUuid,
125
            Action action,
126
            Direction direction) {
127
        this();
128
        this.relUuid = relUuid;
129
        this.direction = direction;
130
        Map<String, IdUuidName> map = presenter.getRelTypeToTaxonIunMap(fromTaxonIun.getUuid(), relUuid);
131
        taxonRTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY);
132
        toTaxonIun = map.get(EditConceptRelationshipPresenter.TO_TAXON_KEY);
133
        init(fromTaxonIun, taxonRTypeIun, toTaxonIun, action);
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
    public EditConceptRelationshipComposite() {
144

    
145
        buildMainLayout();
146
        buildToTaxon();
147
        setCompositionRoot(mainLayout);
148

    
149
        direction = Direction.LEFT_RIGHT;
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
        initFromTaxonLabel();
166
        initConceptRComboBox();
167
        initToTaxon();
168
        initDirectionLabels();
169
    }
170

    
171
    public void setWindow(Window window) {
172
        this.window = window;
173
    }
174
    private void initFromTaxonLabel() {
175
        fromTaxonValue.setValue(fromTaxonIun.getName());
176
    }
177

    
178
    private void initDirectionLabels() {
179

    
180
        leftLabel.addStyleName("cr-arrow");
181
        leftLabel.setContentMode(ContentMode.HTML);
182

    
183
        rightLabel.addStyleName("cr-arrow");
184
        rightLabel.setContentMode(ContentMode.HTML);
185

    
186
        switch(direction) {
187
        case LEFT_RIGHT:
188
            leftLabel.setValue(FontAwesome.LONG_ARROW_RIGHT.getHtml());
189
            rightLabel.setValue(FontAwesome.LONG_ARROW_RIGHT.getHtml());
190
            break;
191
        case RIGHT_LEFT:
192
            leftLabel.setValue(FontAwesome.LONG_ARROW_LEFT.getHtml());
193
            rightLabel.setValue(FontAwesome.LONG_ARROW_LEFT.getHtml());
194
            break;
195
        }
196
    }
197

    
198
    private void initConceptRComboBox() {
199
        conceptRComboBox.setImmediate(true);
200
        conceptRComboBox.setItemCaptionPropertyId("titleCache");
201
        try {
202
            conceptRComboBox.setContainerDataSource(presenter.loadTaxonRelationshipTypeContainer());
203
        } catch (SQLException e) {
204
            // TODO Auto-generated catch block
205
            e.printStackTrace();
206
        }
207
        if(taxonRTypeIun == null) {
208
            conceptRComboBox.setInputPrompt(CHOOSE_TREL_TYPE);
209
        } else {
210
            conceptRComboBox.setValue(new RowId(taxonRTypeIun.getId()));
211
        }
212

    
213
        if(action == Action.Delete) {
214
            conceptRComboBox.setReadOnly(true);
215
            saveButton.setCaption("ok");
216
        }
217
    }
218

    
219
    private void buildToTaxon() {
220
        toTaxonVLayout = buildToTaxonVLayout();
221
        toTaxonLayoutWrapper = new DragAndDropWrapper(toTaxonVLayout);
222
        toTaxonLayoutWrapper.setImmediate(false);
223
        toTaxonLayoutWrapper.setWidth("-1px");
224
        toTaxonLayoutWrapper.setHeight("-1px");
225
        toTaxonTextField.setReadOnly(true);
226

    
227
        toTaxonLayoutWrapper.setDropHandler(new DropHandler() {
228

    
229
            @Override
230
            public AcceptCriterion getAcceptCriterion() {
231
                return AcceptAll.get();
232
            }
233

    
234
            @Override
235
            public void drop(DragAndDropEvent event) {
236
                // Wrapper for the object that is dragged
237
                Transferable t = event.getTransferable();
238

    
239
                // Make sure the drag source is a status composite tree table
240
                if (action != Action.Delete && t.getSourceComponent() instanceof TreeTable) {
241
                    TreeTable table = (TreeTable)t.getSourceComponent();
242
                    Hierarchical containerDataSource = table.getContainerDataSource();
243
                    if(containerDataSource instanceof LeafNodeTaxonContainer) {
244
                        LeafNodeTaxonContainer lntc = (LeafNodeTaxonContainer)containerDataSource;
245
                        Object sourceItemId = t.getData("itemId");
246
                        String toName = (String)lntc.getProperty(sourceItemId, LeafNodeTaxonContainer.NAME_ID).getValue();
247
                        toTaxonIun = new IdUuidName(sourceItemId,
248
                                lntc.getUuid(sourceItemId),
249
                                toName);
250
                        toTaxonTextField.setReadOnly(false);
251
                        toTaxonTextField.setValue(toName);
252
                        toTaxonTextField.setReadOnly(true);
253
                    }
254
                }
255
            }
256
        });
257
        horizontalLayout.addComponent(toTaxonLayoutWrapper);
258
        horizontalLayout.setComponentAlignment(toTaxonLayoutWrapper, new Alignment(48));
259

    
260
    }
261

    
262
    private void initToTaxon() {
263
        toTaxonTextField.setReadOnly(false);
264
        if(toTaxonIun == null) {
265
            toTaxonTextField.setValue(DRAG_TAXON_HINT);
266
        } else {
267
            toTaxonTextField.setValue(toTaxonIun.getName());
268
        }
269
        toTaxonTextField.setReadOnly(true);
270
    }
271

    
272
    private void addUIListeners() {
273
        addSaveButtonListener();
274
        addCancelButtonListener();
275

    
276
    }
277

    
278
    private void addSaveButtonListener() {
279
        saveButton.addClickListener(new ClickListener() {
280

    
281
            @Override
282
            public void buttonClick(ClickEvent event) {
283

    
284

    
285
                try {
286
                    conceptRComboBox.validate();
287
                    toTaxonTextField.validate();
288
                    if(toTaxonIun == null) {
289
                        // FIXME: Not efficient - figure out a way
290
                        // of validation including the null check
291
                        throw new EmptyValueException("");
292
                    }
293
                } catch (EmptyValueException e) {
294
                    Notification notification = new Notification("Invalid input", "Neither Relationship Type nor To Taxon can be empty", Type.WARNING_MESSAGE);
295
                    notification.setDelayMsec(2000);
296
                    notification.show(Page.getCurrent());
297
                    return;
298
                }
299

    
300
                CdmVaadinUtilities.setEnabled(mainLayout, false, null);
301

    
302
                try {
303
                    CdmVaadinUtilities.exec(new CdmVaadinOperation(200, cdmProgressComponent) {
304
                        @Override
305
                        public boolean execute() {
306
                            UUID relTypeUuid = presenter.getTaxonRTypeContainer().getUuid(conceptRComboBox.getValue());
307
                            switch(action) {
308
                            case Create:
309
                                setProgress("Saving New Concept Relationship");
310
                                presenter.createRelationship(fromTaxonIun.getUuid(), relTypeUuid, toTaxonIun.getUuid());
311
                                registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
312
                                break;
313
                            case Update:
314
                                setProgress("Update Concept Relationship");
315
                                presenter.updateRelationship(fromTaxonIun.getUuid(), relUuid, relTypeUuid, toTaxonIun.getUuid());
316
                                registerDelayedEvent(new CdmChangeEvent(Action.Update, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
317
                                break;
318
                            case Delete:
319
                                setProgress("Deleting Concept Relationship");
320
                                presenter.deleteRelationship(fromTaxonIun.getUuid(), relUuid);
321
                                registerDelayedEvent(new CdmChangeEvent(Action.Delete, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class));
322
                                break;
323
                            default:
324

    
325
                            }
326
                            return true;
327
                        }
328

    
329
                        @Override
330
                        public void postOpUIUpdate(boolean success) {
331
                            if(success) {
332
                                if(window != null) {
333
                                    UI.getCurrent().removeWindow(window);
334
                                }
335
                            } else {
336
                                CdmVaadinUtilities.setEnabled(mainLayout, true, null);
337
                            }
338
                        }
339
                    });
340
                } finally {
341
                    CdmVaadinSessionUtilities.getCurrentBasicEventService()
342
                    .fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), false);
343
                }
344
            }
345
        });
346
    }
347

    
348
    private void addCancelButtonListener() {
349
        cancelButton.addClickListener(new ClickListener() {
350

    
351
            @Override
352
            public void buttonClick(ClickEvent event) {
353
                if(window != null) {
354
                    UI.getCurrent().removeWindow(window);
355
                }
356
                CdmVaadinSessionUtilities.getCurrentBasicEventService()
357
                .fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), true);
358
            }
359
        });
360
    }
361

    
362

    
363
    private static void showInDialog(String windowTitle,
364
            EditConceptRelationshipComposite ecrc) {
365
        Window dialog = new Window(windowTitle);
366
        dialog.setModal(false);
367
        dialog.setClosable(false);
368
        dialog.setResizable(false);
369
        UI.getCurrent().addWindow(dialog);
370
        ecrc.setWindow(dialog);
371
        dialog.setContent(ecrc);
372
        CdmVaadinSessionUtilities.getCurrentBasicEventService()
373
        .fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_START_ID, ConceptRelationshipComposite.class), false);
374
    }
375

    
376
    public static void showInDialog(String windowTitle,
377
            IdUuidName fromTaxonIun,
378
            IdUuidName taxonRTypeIun,
379
            IdUuidName toTaxonIun,
380
            Action action,
381
            Direction direction) {
382
        EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action, direction);
383
        showInDialog(windowTitle, ecrc);
384
    }
385

    
386
    public static void showInDialog(String windowTitle,
387
            IdUuidName fromTaxonIun,
388
            UUID relUuid,
389
            Action action,
390
            Direction direction) {
391
        EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, relUuid, action, direction);
392
        showInDialog(windowTitle, ecrc);
393
    }
394

    
395
    private VerticalLayout buildToTaxonVLayout() {
396
        // common part: create layout
397
        toTaxonVLayout = new VerticalLayout();
398
        toTaxonVLayout.setImmediate(false);
399
        toTaxonVLayout.setWidth("-1px");
400
        toTaxonVLayout.setHeight("-1px");
401
        toTaxonVLayout.setMargin(false);
402
        toTaxonVLayout.setSpacing(true);
403

    
404
        // toTaxonLabeL
405
        toTaxonLabeL = new Label();
406
        toTaxonLabeL.setImmediate(false);
407
        toTaxonLabeL.setWidth("-1px");
408
        toTaxonLabeL.setHeight("-1px");
409
        toTaxonLabeL.setValue("To Taxon");
410
        toTaxonVLayout.addComponent(toTaxonLabeL);
411
        toTaxonVLayout.setComponentAlignment(toTaxonLabeL, new Alignment(48));
412

    
413
        // toTaxonTextField
414
        toTaxonTextField = new TextField();
415
        toTaxonTextField.setImmediate(false);
416
        toTaxonTextField.setWidth("-1px");
417
        toTaxonTextField.setHeight("-1px");
418
        toTaxonTextField.setInvalidAllowed(false);
419
        toTaxonTextField.setRequired(true);
420
        toTaxonTextField.setInputPrompt("Drag Taxon here ...");
421
        toTaxonVLayout.addComponent(toTaxonTextField);
422
        toTaxonVLayout.setComponentAlignment(toTaxonTextField, new Alignment(48));
423

    
424
        return toTaxonVLayout;
425
    }
426

    
427
    @AutoGenerated
428
    private VerticalLayout buildMainLayout() {
429
        // common part: create layout
430
        mainLayout = new VerticalLayout();
431
        mainLayout.setImmediate(false);
432
        mainLayout.setWidth("700px");
433
        mainLayout.setHeight("170px");
434
        mainLayout.setMargin(false);
435
        mainLayout.setSpacing(true);
436

    
437
        // top-level component properties
438
        setWidth("700px");
439
        setHeight("170px");
440

    
441
        // horizontalLayout
442
        horizontalLayout = buildHorizontalLayout();
443
        mainLayout.addComponent(horizontalLayout);
444
        mainLayout.setExpandRatio(horizontalLayout, 1.0f);
445
        mainLayout.setComponentAlignment(horizontalLayout, new Alignment(48));
446

    
447
        // saveCancelHLayout
448
        saveCancelHLayout = buildSaveCancelHLayout();
449
        mainLayout.addComponent(saveCancelHLayout);
450
        mainLayout.setComponentAlignment(saveCancelHLayout, new Alignment(48));
451

    
452
        // cdmProgressComponent
453
        cdmProgressComponent = new CdmProgressComponent();
454
        cdmProgressComponent.setImmediate(false);
455
        cdmProgressComponent.setWidth("-1px");
456
        cdmProgressComponent.setHeight("-1px");
457
        mainLayout.addComponent(cdmProgressComponent);
458
        mainLayout.setComponentAlignment(cdmProgressComponent, new Alignment(48));
459

    
460
        return mainLayout;
461
    }
462

    
463
    @AutoGenerated
464
    private HorizontalLayout buildHorizontalLayout() {
465
        // common part: create layout
466
        horizontalLayout = new HorizontalLayout();
467
        horizontalLayout.setImmediate(false);
468
        horizontalLayout.setWidth("-1px");
469
        horizontalLayout.setHeight("-1px");
470
        horizontalLayout.setMargin(true);
471
        horizontalLayout.setSpacing(true);
472

    
473
        // fromTaxonVLayout
474
        fromTaxonVLayout = buildFromTaxonVLayout();
475
        horizontalLayout.addComponent(fromTaxonVLayout);
476
        horizontalLayout.setComponentAlignment(fromTaxonVLayout, new Alignment(48));
477

    
478
        // leftLabel
479
        leftLabel = new Label();
480
        leftLabel.setImmediate(false);
481
        leftLabel.setWidth("-1px");
482
        leftLabel.setHeight("-1px");
483
        leftLabel.setValue("Label");
484
        horizontalLayout.addComponent(leftLabel);
485
        horizontalLayout.setComponentAlignment(leftLabel, new Alignment(24));
486

    
487
        // typeVLayout
488
        typeVLayout = buildTypeVLayout();
489
        horizontalLayout.addComponent(typeVLayout);
490
        horizontalLayout.setComponentAlignment(typeVLayout, new Alignment(48));
491

    
492
        // rightLabel
493
        rightLabel = new Label();
494
        rightLabel.setImmediate(false);
495
        rightLabel.setWidth("-1px");
496
        rightLabel.setHeight("-1px");
497
        rightLabel.setValue("Label");
498
        horizontalLayout.addComponent(rightLabel);
499
        horizontalLayout.setComponentAlignment(rightLabel, new Alignment(24));
500

    
501
        return horizontalLayout;
502
    }
503

    
504
    @AutoGenerated
505
    private VerticalLayout buildFromTaxonVLayout() {
506
        // common part: create layout
507
        fromTaxonVLayout = new VerticalLayout();
508
        fromTaxonVLayout.setImmediate(false);
509
        fromTaxonVLayout.setWidth("-1px");
510
        fromTaxonVLayout.setHeight("-1px");
511
        fromTaxonVLayout.setMargin(false);
512
        fromTaxonVLayout.setSpacing(true);
513

    
514
        // fromTaxonLabel
515
        fromTaxonLabel = new Label();
516
        fromTaxonLabel.setImmediate(false);
517
        fromTaxonLabel.setWidth("-1px");
518
        fromTaxonLabel.setHeight("-1px");
519
        fromTaxonLabel.setValue("From Taxon");
520
        fromTaxonVLayout.addComponent(fromTaxonLabel);
521
        fromTaxonVLayout.setComponentAlignment(fromTaxonLabel, new Alignment(48));
522

    
523
        // fromTaxonValue
524
        fromTaxonValue = new Label();
525
        fromTaxonValue.setImmediate(false);
526
        fromTaxonValue.setWidth("-1px");
527
        fromTaxonValue.setHeight("-1px");
528
        fromTaxonValue.setValue("Taxon Name");
529
        fromTaxonVLayout.addComponent(fromTaxonValue);
530
        fromTaxonVLayout.setComponentAlignment(fromTaxonValue, new Alignment(48));
531

    
532
        return fromTaxonVLayout;
533
    }
534

    
535
    @AutoGenerated
536
    private VerticalLayout buildTypeVLayout() {
537
        // common part: create layout
538
        typeVLayout = new VerticalLayout();
539
        typeVLayout.setImmediate(false);
540
        typeVLayout.setWidth("-1px");
541
        typeVLayout.setHeight("-1px");
542
        typeVLayout.setMargin(false);
543
        typeVLayout.setSpacing(true);
544

    
545
        // typeLabel
546
        typeLabel = new Label();
547
        typeLabel.setImmediate(false);
548
        typeLabel.setWidth("-1px");
549
        typeLabel.setHeight("-1px");
550
        typeLabel.setValue("Type");
551
        typeVLayout.addComponent(typeLabel);
552
        typeVLayout.setComponentAlignment(typeLabel, new Alignment(48));
553

    
554
        // conceptRComboBox
555
        conceptRComboBox = new ComboBox();
556
        conceptRComboBox.setImmediate(false);
557
        conceptRComboBox.setWidth("-1px");
558
        conceptRComboBox.setHeight("-1px");
559
        conceptRComboBox.setRequired(true);
560
        typeVLayout.addComponent(conceptRComboBox);
561
        typeVLayout.setComponentAlignment(conceptRComboBox, new Alignment(48));
562

    
563
        return typeVLayout;
564
    }
565

    
566
    @AutoGenerated
567
    private HorizontalLayout buildSaveCancelHLayout() {
568
        // common part: create layout
569
        saveCancelHLayout = new HorizontalLayout();
570
        saveCancelHLayout.setImmediate(false);
571
        saveCancelHLayout.setWidth("-1px");
572
        saveCancelHLayout.setHeight("-1px");
573
        saveCancelHLayout.setMargin(false);
574
        saveCancelHLayout.setSpacing(true);
575

    
576
        // saveButton
577
        saveButton = new Button();
578
        saveButton.setCaption("save");
579
        saveButton.setImmediate(true);
580
        saveButton.setWidth("-1px");
581
        saveButton.setHeight("-1px");
582
        saveCancelHLayout.addComponent(saveButton);
583

    
584
        // cancelButton
585
        cancelButton = new Button();
586
        cancelButton.setCaption("cancel");
587
        cancelButton.setImmediate(true);
588
        cancelButton.setWidth("-1px");
589
        cancelButton.setHeight("-1px");
590
        saveCancelHLayout.addComponent(cancelButton);
591

    
592
        return saveCancelHLayout;
593
    }
594

    
595
}
(5-5/8)