Revision 6809e6bd
Added by Cherian Mathew about 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTree.java | ||
---|---|---|
49 | 49 |
|
50 | 50 |
private Mode mode; |
51 | 51 |
|
52 |
public enum Direction { |
|
53 |
LEFT_RIGHT("left-right"), |
|
54 |
RIGHT_LEFT("right-left"); |
|
55 |
|
|
56 |
private final String name; |
|
57 |
|
|
58 |
private Direction(String s) { |
|
59 |
name = s; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public String toString(){ |
|
64 |
return name; |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
private Direction direction; |
|
69 |
|
|
52 | 70 |
private ConceptRelationshipComposite conceptRelComposite; |
53 | 71 |
|
54 | 72 |
public D3ConceptRelationshipTree() { |
55 |
this(Mode.OneToOne); |
|
73 |
this(Mode.OneToOne, Direction.LEFT_RIGHT);
|
|
56 | 74 |
} |
57 | 75 |
|
58 |
public D3ConceptRelationshipTree(Mode mode) { |
|
59 |
this.mode = mode; |
|
76 |
public D3ConceptRelationshipTree(Direction direction) { |
|
77 |
this(Mode.OneToOne, direction); |
|
78 |
} |
|
60 | 79 |
|
80 |
public D3ConceptRelationshipTree(Mode mode, Direction direction) { |
|
81 |
this.mode = mode; |
|
82 |
this.direction = direction; |
|
61 | 83 |
addFunction("select", new JavaScriptFunction() { |
62 | 84 |
|
63 | 85 |
@Override |
... | ... | |
78 | 100 |
} |
79 | 101 |
|
80 | 102 |
|
81 |
public void update(Taxon fromTaxon) throws JSONException { |
|
103 |
public void update(Taxon fromTaxon, Direction direction) throws JSONException { |
|
104 |
this.direction = direction; |
|
82 | 105 |
switch(mode) { |
83 | 106 |
case OneToOne: |
84 | 107 |
updateForOneToOne(fromTaxon); |
... | ... | |
101 | 124 |
fromTaxonJO.put("name", fromTaxon.getName().getTitleCache()); |
102 | 125 |
fromTaxonJO.put("uuid", fromTaxon.getUuid().toString()); |
103 | 126 |
fromTaxonJO.put("type", "taxon"); |
127 |
fromTaxonJO.put("direction", direction.toString()); |
|
104 | 128 |
|
105 | 129 |
JSONArray ftChildren = new JSONArray(); |
106 | 130 |
fromTaxonJO.put("children", ftChildren); |
Also available in: Unified diff
D3ConceptRelationshipTree, ConceptRelationshipComposite, ConceptRelationshipPresenter, ConceptRelationshipView, IConceptRelationshipComponentListener : added directional variable to display cr tree in both direction
d3.conceptrelationshiptree_connector.js : updated to handle bi-directional display
D3CTree, ConceptRelationshipPresenterTest, d3ctree_connector.js : testing bi-directional display