Project

General

Profile

« Previous | Next » 

Revision 6f501be5

Added by Cherian Mathew about 9 years ago

ConceptRelationshipComposite : made direction aware
EditConceptRelationshipComposite : made direction aware and added arrows as hints
StatusComposite, ConceptRelationshipView : moved taxon table drop handler from status composite to view
edit.scss, styles.css : added arrow styles

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/EditConceptRelationshipComposite.java
23 23
import com.vaadin.event.dd.DropHandler;
24 24
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
25 25
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
26
import com.vaadin.server.FontAwesome;
26 27
import com.vaadin.server.Page;
28
import com.vaadin.shared.ui.label.ContentMode;
27 29
import com.vaadin.ui.Alignment;
28 30
import com.vaadin.ui.Button;
29 31
import com.vaadin.ui.Button.ClickEvent;
......
43 45

  
44 46
import eu.etaxonomy.cdm.vaadin.container.IdUuidName;
45 47
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer;
48
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree.Direction;
46 49
import eu.etaxonomy.cdm.vaadin.presenter.EditConceptRelationshipPresenter;
47 50
import eu.etaxonomy.cdm.vaadin.session.BasicEvent;
48 51
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent;
......
73 76
    @AutoGenerated
74 77
    private HorizontalLayout horizontalLayout;
75 78
    @AutoGenerated
79
    private Label rightLabel;
80
    @AutoGenerated
76 81
    private VerticalLayout typeVLayout;
77 82
    @AutoGenerated
78 83
    private ComboBox conceptRComboBox;
79 84
    @AutoGenerated
80 85
    private Label typeLabel;
81 86
    @AutoGenerated
87
    private Label leftLabel;
88
    @AutoGenerated
82 89
    private VerticalLayout fromTaxonVLayout;
83 90
    @AutoGenerated
84 91
    private Label fromTaxonValue;
......
100 107

  
101 108

  
102 109
    private Action action;
110
    private Direction direction;
103 111

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

  
111 121
    }
112 122

  
113 123
    public EditConceptRelationshipComposite(IdUuidName fromTaxonIun,
114 124
            UUID relUuid,
115
            Action action) {
125
            Action action,
126
            Direction direction) {
116 127
        this();
117 128
        this.relUuid = relUuid;
129
        this.direction = direction;
118 130
        Map<String, IdUuidName> map = presenter.getRelTypeToTaxonIunMap(fromTaxonIun.getUuid(), relUuid);
119 131
        taxonRTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY);
120 132
        toTaxonIun = map.get(EditConceptRelationshipPresenter.TO_TAXON_KEY);
......
134 146
        buildToTaxon();
135 147
        setCompositionRoot(mainLayout);
136 148

  
149
        direction = Direction.LEFT_RIGHT;
137 150
        this.presenter = new EditConceptRelationshipPresenter();
138 151
        addUIListeners();
139 152

  
......
152 165
        initFromTaxonLabel();
153 166
        initConceptRComboBox();
154 167
        initToTaxon();
168
        initDirectionLabels();
155 169
    }
156 170

  
157 171
    public void setWindow(Window window) {
......
161 175
        fromTaxonValue.setValue(fromTaxonIun.getName());
162 176
    }
163 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

  
164 198
    private void initConceptRComboBox() {
165 199
        conceptRComboBox.setImmediate(true);
166 200
        conceptRComboBox.setItemCaptionPropertyId("titleCache");
......
335 369
        UI.getCurrent().addWindow(dialog);
336 370
        ecrc.setWindow(dialog);
337 371
        dialog.setContent(ecrc);
372
        CdmVaadinSessionUtilities.getCurrentBasicEventService()
373
        .fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_START_ID, ConceptRelationshipComposite.class), false);
338 374
    }
339 375

  
340 376
    public static void showInDialog(String windowTitle,
341 377
            IdUuidName fromTaxonIun,
342 378
            IdUuidName taxonRTypeIun,
343 379
            IdUuidName toTaxonIun,
344
            Action action) {
345
        EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action);
380
            Action action,
381
            Direction direction) {
382
        EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action, direction);
346 383
        showInDialog(windowTitle, ecrc);
347 384
    }
348 385

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

  
......
391 429
        // common part: create layout
392 430
        mainLayout = new VerticalLayout();
393 431
        mainLayout.setImmediate(false);
394
        mainLayout.setWidth("602px");
432
        mainLayout.setWidth("700px");
395 433
        mainLayout.setHeight("170px");
396 434
        mainLayout.setMargin(false);
397 435
        mainLayout.setSpacing(true);
398 436

  
399 437
        // top-level component properties
400
        setWidth("602px");
438
        setWidth("700px");
401 439
        setHeight("170px");
402 440

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

  
407 447
        // saveCancelHLayout
408 448
        saveCancelHLayout = buildSaveCancelHLayout();
......
425 465
        // common part: create layout
426 466
        horizontalLayout = new HorizontalLayout();
427 467
        horizontalLayout.setImmediate(false);
428
        horizontalLayout.setWidth("602px");
468
        horizontalLayout.setWidth("-1px");
429 469
        horizontalLayout.setHeight("-1px");
430 470
        horizontalLayout.setMargin(true);
431 471
        horizontalLayout.setSpacing(true);
......
435 475
        horizontalLayout.addComponent(fromTaxonVLayout);
436 476
        horizontalLayout.setComponentAlignment(fromTaxonVLayout, new Alignment(48));
437 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

  
438 487
        // typeVLayout
439 488
        typeVLayout = buildTypeVLayout();
440 489
        horizontalLayout.addComponent(typeVLayout);
441
        horizontalLayout.setExpandRatio(typeVLayout, 1.0f);
442 490
        horizontalLayout.setComponentAlignment(typeVLayout, new Alignment(48));
443 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

  
444 501
        return horizontalLayout;
445 502
    }
446 503

  

Also available in: Unified diff