Revision 513ad98e
Added by Cherian Mathew about 9 years ago
.gitattributes | ||
---|---|---|
3 | 3 |
/pom.xml -text |
4 | 4 |
src/main/java/eu/etaxonomy/cdm/vaadin/AppWidgetSet.gwt.xml -text |
5 | 5 |
src/main/java/eu/etaxonomy/cdm/vaadin/CdmAppInitializer.java.bkp -text |
6 |
src/main/java/eu/etaxonomy/cdm/vaadin/component/ConceptRelationshipComposite.java -text |
|
6 | 7 |
src/main/java/eu/etaxonomy/cdm/vaadin/component/HorizontalToolbar.java -text |
7 | 8 |
src/main/java/eu/etaxonomy/cdm/vaadin/component/NewTaxonBaseComposite.java -text |
8 | 9 |
src/main/java/eu/etaxonomy/cdm/vaadin/component/StatusComposite.java -text |
... | ... | |
10 | 11 |
src/main/java/eu/etaxonomy/cdm/vaadin/container/CdmSpringConnectionPool.java -text |
11 | 12 |
src/main/java/eu/etaxonomy/cdm/vaadin/container/IdAndUuid.java -text |
12 | 13 |
src/main/java/eu/etaxonomy/cdm/vaadin/container/LeafNodeTaxonContainer.java -text |
14 |
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTree.java -text |
|
15 |
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTreeState.java -text |
|
13 | 16 |
src/main/java/eu/etaxonomy/cdm/vaadin/model/BeanItemContainerExample.java -text |
14 | 17 |
src/main/java/eu/etaxonomy/cdm/vaadin/model/CdmTaxonTableCollection.java -text |
15 | 18 |
src/main/java/eu/etaxonomy/cdm/vaadin/model/DbTableDTO.java -text |
... | ... | |
19 | 22 |
src/main/java/eu/etaxonomy/cdm/vaadin/model/StatusDTO.java -text |
20 | 23 |
src/main/java/eu/etaxonomy/cdm/vaadin/model/taxonDTO.java -text |
21 | 24 |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/AuthenticationPresenter.java -text |
25 |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/ConceptRelationshipPresenter.java -text |
|
22 | 26 |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/NewTaxonBasePresenter.java -text |
23 | 27 |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenter.java -text |
24 | 28 |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/DistributionSelectionPresenter.java -text |
... | ... | |
34 | 38 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/AbstractAuthenticatedUI.java -text |
35 | 39 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/CdmBaseUI.java -text |
36 | 40 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/CheckUI.java -text |
41 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/ConceptRelationshipUI.java -text |
|
37 | 42 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DbStatusUI.java -text |
38 | 43 |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/StatusEditorUI.java -text |
39 | 44 |
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmQueryFactory.java -text |
... | ... | |
43 | 48 |
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinUtilities.java -text |
44 | 49 |
src/main/java/eu/etaxonomy/cdm/vaadin/util/SQLUtils.java -text |
45 | 50 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/AuthenticationView.java -text |
51 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/ConceptRelationshipView.java -text |
|
46 | 52 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IAuthenticationComponent.java -text |
53 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IConceptRelationshipComponentListener.java -text |
|
47 | 54 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/INewTaxonBaseComponentListener.java -text |
48 | 55 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/INewTaxonBaseComposite.java -text |
49 | 56 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IStatusComposite.java -text |
... | ... | |
61 | 68 |
src/main/webapp/META-INF/services/javax.servlet.ServletContainerInitializer -text |
62 | 69 |
src/main/webapp/VAADIN/themes/edit/addons.scss -text |
63 | 70 |
src/main/webapp/VAADIN/themes/edit/edit.scss -text |
71 |
src/main/webapp/VAADIN/themes/edit/favicon.ico -text |
|
64 | 72 |
src/main/webapp/VAADIN/themes/edit/styles.css -text |
65 | 73 |
src/main/webapp/VAADIN/themes/edit/styles.scss -text |
66 | 74 |
src/main/webapp/VAADIN/themes/macosx/addons.scss -text |
src/main/java/eu/etaxonomy/cdm/vaadin/component/ConceptRelationshipComposite.java | ||
---|---|---|
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.util.UUID; |
|
13 |
|
|
14 |
import org.json.JSONException; |
|
15 |
|
|
16 |
import com.vaadin.annotations.AutoGenerated; |
|
17 |
import com.vaadin.ui.Alignment; |
|
18 |
import com.vaadin.ui.Button; |
|
19 |
import com.vaadin.ui.CustomComponent; |
|
20 |
import com.vaadin.ui.HorizontalLayout; |
|
21 |
import com.vaadin.ui.Notification; |
|
22 |
import com.vaadin.ui.Notification.Type; |
|
23 |
import com.vaadin.ui.VerticalLayout; |
|
24 |
|
|
25 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree; |
|
26 |
import eu.etaxonomy.cdm.vaadin.presenter.ConceptRelationshipPresenter; |
|
27 |
import eu.etaxonomy.cdm.vaadin.session.ISelectionListener; |
|
28 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
|
29 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
30 |
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author cmathew |
|
34 |
* @date 9 Apr 2015 |
|
35 |
* |
|
36 |
*/ |
|
37 |
public class ConceptRelationshipComposite extends CustomComponent implements ISelectionListener { |
|
38 |
|
|
39 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
40 |
|
|
41 |
@AutoGenerated |
|
42 |
private VerticalLayout mainLayout; |
|
43 |
@AutoGenerated |
|
44 |
private D3ConceptRelationshipTree d3ConceptRelationShipTree; |
|
45 |
@AutoGenerated |
|
46 |
private HorizontalLayout updateHorizontalLayout; |
|
47 |
@AutoGenerated |
|
48 |
private Button deleteButton; |
|
49 |
@AutoGenerated |
|
50 |
private Button editButton; |
|
51 |
@AutoGenerated |
|
52 |
private Button newButton; |
|
53 |
private final IConceptRelationshipComponentListener listener; |
|
54 |
/** |
|
55 |
* The constructor should first build the main layout, set the |
|
56 |
* composition root and then do any custom initialization. |
|
57 |
* |
|
58 |
* The constructor will not be automatically regenerated by the |
|
59 |
* visual editor. |
|
60 |
*/ |
|
61 |
public ConceptRelationshipComposite() { |
|
62 |
buildMainLayout(); |
|
63 |
setCompositionRoot(mainLayout); |
|
64 |
|
|
65 |
CdmVaadinSessionUtilities.getCurrentSelectionService().register(this); |
|
66 |
listener = new ConceptRelationshipPresenter(d3ConceptRelationShipTree); |
|
67 |
d3ConceptRelationShipTree.setImmediate(true); |
|
68 |
|
|
69 |
} |
|
70 |
|
|
71 |
/* (non-Javadoc) |
|
72 |
* @see eu.etaxonomy.cdm.vaadin.session.ISelectionListener#onSelect(eu.etaxonomy.cdm.vaadin.session.SelectionEvent) |
|
73 |
*/ |
|
74 |
@Override |
|
75 |
public void onSelect(SelectionEvent event) { |
|
76 |
if(event.getSourceType().equals(StatusComposite.class)) { |
|
77 |
UUID taxonUuid = (UUID)event.getSelectedObjects().get(0); |
|
78 |
try { |
|
79 |
listener.updateConceptRelationship(taxonUuid); |
|
80 |
} catch (JSONException e) { |
|
81 |
Notification.show("Error generating concept relation JSON", e.getMessage(), Type.WARNING_MESSAGE); |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
} |
|
86 |
|
|
87 |
@AutoGenerated |
|
88 |
private VerticalLayout buildMainLayout() { |
|
89 |
// common part: create layout |
|
90 |
mainLayout = new VerticalLayout(); |
|
91 |
mainLayout.setImmediate(false); |
|
92 |
mainLayout.setWidth("100%"); |
|
93 |
mainLayout.setHeight("100%"); |
|
94 |
mainLayout.setMargin(true); |
|
95 |
mainLayout.setSpacing(true); |
|
96 |
|
|
97 |
// top-level component properties |
|
98 |
setWidth("100.0%"); |
|
99 |
setHeight("100.0%"); |
|
100 |
|
|
101 |
// updateHorizontalLayout |
|
102 |
updateHorizontalLayout = buildUpdateHorizontalLayout(); |
|
103 |
mainLayout.addComponent(updateHorizontalLayout); |
|
104 |
mainLayout.setComponentAlignment(updateHorizontalLayout, new Alignment(20)); |
|
105 |
|
|
106 |
// d3ConceptRelationShipTree |
|
107 |
d3ConceptRelationShipTree = new D3ConceptRelationshipTree(); |
|
108 |
d3ConceptRelationShipTree.setImmediate(false); |
|
109 |
d3ConceptRelationShipTree.setWidth("-1px"); |
|
110 |
d3ConceptRelationShipTree.setHeight("-1px"); |
|
111 |
mainLayout.addComponent(d3ConceptRelationShipTree); |
|
112 |
mainLayout.setExpandRatio(d3ConceptRelationShipTree, 1.0f); |
|
113 |
mainLayout.setComponentAlignment(d3ConceptRelationShipTree, new Alignment(20)); |
|
114 |
|
|
115 |
return mainLayout; |
|
116 |
} |
|
117 |
|
|
118 |
@AutoGenerated |
|
119 |
private HorizontalLayout buildUpdateHorizontalLayout() { |
|
120 |
// common part: create layout |
|
121 |
updateHorizontalLayout = new HorizontalLayout(); |
|
122 |
updateHorizontalLayout.setImmediate(false); |
|
123 |
updateHorizontalLayout.setWidth("-1px"); |
|
124 |
updateHorizontalLayout.setHeight("-1px"); |
|
125 |
updateHorizontalLayout.setMargin(true); |
|
126 |
updateHorizontalLayout.setSpacing(true); |
|
127 |
|
|
128 |
// newButton |
|
129 |
newButton = new Button(); |
|
130 |
newButton.setCaption("new"); |
|
131 |
newButton.setImmediate(true); |
|
132 |
newButton.setWidth("-1px"); |
|
133 |
newButton.setHeight("-1px"); |
|
134 |
updateHorizontalLayout.addComponent(newButton); |
|
135 |
|
|
136 |
// editButton |
|
137 |
editButton = new Button(); |
|
138 |
editButton.setCaption("edit"); |
|
139 |
editButton.setImmediate(true); |
|
140 |
editButton.setWidth("-1px"); |
|
141 |
editButton.setHeight("-1px"); |
|
142 |
updateHorizontalLayout.addComponent(editButton); |
|
143 |
|
|
144 |
// deleteButton |
|
145 |
deleteButton = new Button(); |
|
146 |
deleteButton.setCaption("delete"); |
|
147 |
deleteButton.setImmediate(true); |
|
148 |
deleteButton.setWidth("-1px"); |
|
149 |
deleteButton.setHeight("-1px"); |
|
150 |
updateHorizontalLayout.addComponent(deleteButton); |
|
151 |
|
|
152 |
return updateHorizontalLayout; |
|
153 |
} |
|
154 |
|
|
155 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTree.java | ||
---|---|---|
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.jscomponent; |
|
11 |
|
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.HashMap; |
|
14 |
import java.util.List; |
|
15 |
import java.util.Map; |
|
16 |
import java.util.Set; |
|
17 |
|
|
18 |
import org.apache.log4j.Logger; |
|
19 |
import org.json.JSONArray; |
|
20 |
import org.json.JSONException; |
|
21 |
import org.json.JSONObject; |
|
22 |
|
|
23 |
import com.vaadin.annotations.JavaScript; |
|
24 |
import com.vaadin.annotations.StyleSheet; |
|
25 |
import com.vaadin.ui.AbstractJavaScriptComponent; |
|
26 |
import com.vaadin.ui.JavaScriptFunction; |
|
27 |
import com.vaadin.ui.Notification; |
|
28 |
import com.vaadin.ui.Notification.Type; |
|
29 |
|
|
30 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
31 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
|
32 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
33 |
|
|
34 |
/** |
|
35 |
* @author cmathew |
|
36 |
* @date 8 Apr 2015 |
|
37 |
* |
|
38 |
*/ |
|
39 |
@StyleSheet({"css/d3.conceptrelationshiptree.css"}) |
|
40 |
@JavaScript({"extlib/d3.min.js", "lib/d3.conceptrelationshiptree_connector.js"}) |
|
41 |
public class D3ConceptRelationshipTree extends AbstractJavaScriptComponent { |
|
42 |
|
|
43 |
private static final Logger logger = Logger.getLogger(D3ConceptRelationshipTree.class); |
|
44 |
|
|
45 |
public D3ConceptRelationshipTree() { |
|
46 |
addFunction("test", new JavaScriptFunction() { |
|
47 |
|
|
48 |
@Override |
|
49 |
public void call(JSONArray arguments) throws JSONException { |
|
50 |
Notification.show("Store selected","uuid : " + arguments.getString(0), Type.WARNING_MESSAGE); |
|
51 |
} |
|
52 |
}); |
|
53 |
//String expected = "{\"name\":\"Taxon D sec. ???\",\"children\":[{\"name\":\"Includes\",\"children\":[{\"name\":\"Taxon A sec. Journal Reference 1\",\"uuid\":\"eaac797e-cac7-4649-97cf-c7b580076895\"},{\"name\":\"Taxon B sec. ???\",\"uuid\":\"77e7d93e-75c6-4dd4-850d-7b5809654378\"}],\"uuid\":\"0501c385-cab1-4fbe-b945-fc747419bb13\"},{\"name\":\"Excludes\",\"children\":[{\"name\":\"Taxon C sec. ???\",\"uuid\":\"3d71c8b8-3bec-4f5f-ba23-6f9d55ef84e9\"}],\"uuid\":\"4535a63c-4a3f-4d69-9350-7bf02e2c23be\"}],\"uuid\":\"5f713f69-e03e-4a11-8a55-700fbbf44805\"}"; |
|
54 |
//setConceptRelationshipTree(expected); |
|
55 |
setConceptRelationshipTree(""); |
|
56 |
|
|
57 |
} |
|
58 |
|
|
59 |
public void updateConceptRelationshipTree(Taxon fromTaxon) throws JSONException { |
|
60 |
Set<TaxonRelationship> relationsFromThisTaxon = fromTaxon.getRelationsFromThisTaxon(); |
|
61 |
|
|
62 |
Map<TaxonRelationshipType, List<Taxon>> relToTaxonMap = new HashMap<TaxonRelationshipType, List<Taxon>>(); |
|
63 |
|
|
64 |
|
|
65 |
JSONObject fromTaxonJO = new JSONObject(); |
|
66 |
fromTaxonJO.put("name", fromTaxon.getTitleCache()); |
|
67 |
fromTaxonJO.put("uuid", fromTaxon.getUuid().toString()); |
|
68 |
|
|
69 |
if(relationsFromThisTaxon !=null && !relationsFromThisTaxon.isEmpty()) { |
|
70 |
for(TaxonRelationship tr : relationsFromThisTaxon) { |
|
71 |
if(fromTaxon.equals(tr.getFromTaxon())) { |
|
72 |
if(relToTaxonMap.containsKey(tr.getType())) { |
|
73 |
relToTaxonMap.get(tr.getType()).add(tr.getToTaxon()); |
|
74 |
} else { |
|
75 |
List<Taxon> toTaxonList = new ArrayList<Taxon>(); |
|
76 |
toTaxonList.add(tr.getToTaxon()); |
|
77 |
relToTaxonMap.put(tr.getType(), toTaxonList); |
|
78 |
} |
|
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
int typeIndex = 0; |
|
83 |
JSONArray ftChildren = new JSONArray(); |
|
84 |
fromTaxonJO.put("children", ftChildren); |
|
85 |
|
|
86 |
for (Map.Entry<TaxonRelationshipType, List<Taxon>> entry : relToTaxonMap.entrySet()) { |
|
87 |
|
|
88 |
JSONObject crJO = new JSONObject(); |
|
89 |
crJO.put("name", entry.getKey().getTitleCache()); |
|
90 |
crJO.put("uuid", entry.getKey().getUuid()); |
|
91 |
|
|
92 |
JSONArray crChildrenJA = new JSONArray(); |
|
93 |
crJO.put("children", crChildrenJA); |
|
94 |
|
|
95 |
int toTaxonIndex = 0; |
|
96 |
for(Taxon toTaxon: entry.getValue()) { |
|
97 |
JSONObject toTaxonJO = new JSONObject(); |
|
98 |
toTaxonJO.put("name", toTaxon.getTitleCache()); |
|
99 |
toTaxonJO.put("uuid", toTaxon.getUuid()); |
|
100 |
crChildrenJA.put(toTaxonIndex, toTaxonJO); |
|
101 |
toTaxonIndex++; |
|
102 |
} |
|
103 |
|
|
104 |
ftChildren.put(typeIndex, crJO); |
|
105 |
typeIndex++; |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
|
|
110 |
setConceptRelationshipTree(fromTaxonJO.toString());; |
|
111 |
} |
|
112 |
|
|
113 |
public void setConceptRelationshipTree(String conceptRelationshipTree) { |
|
114 |
getState().setConceptRelationshipTree(conceptRelationshipTree);; |
|
115 |
} |
|
116 |
|
|
117 |
@Override |
|
118 |
public D3ConceptRelationshipTreeState getState() { |
|
119 |
return (D3ConceptRelationshipTreeState) super.getState(); |
|
120 |
} |
|
121 |
|
|
122 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTreeState.java | ||
---|---|---|
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.jscomponent; |
|
11 |
|
|
12 |
import com.vaadin.shared.ui.JavaScriptComponentState; |
|
13 |
|
|
14 |
/** |
|
15 |
* @author cmathew |
|
16 |
* @date 8 Apr 2015 |
|
17 |
* |
|
18 |
*/ |
|
19 |
public class D3ConceptRelationshipTreeState extends JavaScriptComponentState { |
|
20 |
|
|
21 |
private String conceptRelationshipTree; |
|
22 |
|
|
23 |
|
|
24 |
public String getConceptRelationshipTree() { |
|
25 |
return conceptRelationshipTree; |
|
26 |
} |
|
27 |
|
|
28 |
public void setConceptRelationshipTree(String conceptRelationshipTree) { |
|
29 |
this.conceptRelationshipTree = conceptRelationshipTree; |
|
30 |
} |
|
31 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/ConceptRelationshipPresenter.java | ||
---|---|---|
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.presenter; |
|
11 |
|
|
12 |
import java.util.Arrays; |
|
13 |
import java.util.List; |
|
14 |
import java.util.UUID; |
|
15 |
|
|
16 |
import org.json.JSONException; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
19 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
20 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
21 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree; |
|
22 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
|
23 |
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author cmathew |
|
27 |
* @date 9 Apr 2015 |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class ConceptRelationshipPresenter implements IConceptRelationshipComponentListener { |
|
31 |
|
|
32 |
private final ITaxonService taxonService; |
|
33 |
private final D3ConceptRelationshipTree crTree; |
|
34 |
|
|
35 |
public ConceptRelationshipPresenter(D3ConceptRelationshipTree crTree) { |
|
36 |
taxonService = CdmSpringContextHelper.getTaxonService(); |
|
37 |
this.crTree = crTree; |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public void updateConceptRelationship(UUID taxonUuid) throws JSONException { |
|
42 |
List<String> FROM_TAXON_INIT_STRATEGY = Arrays.asList(new String []{ |
|
43 |
"relationsFromThisTaxon" |
|
44 |
}); |
|
45 |
|
|
46 |
Taxon taxon = CdmBase.deproxy(taxonService.load(taxonUuid, FROM_TAXON_INIT_STRATEGY), Taxon.class); |
|
47 |
crTree.updateConceptRelationshipTree(taxon); |
|
48 |
} |
|
49 |
|
|
50 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/ConceptRelationshipUI.java | ||
---|---|---|
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.ui; |
|
11 |
|
|
12 |
import java.util.logging.Logger; |
|
13 |
|
|
14 |
import javax.servlet.annotation.WebServlet; |
|
15 |
|
|
16 |
import com.vaadin.annotations.Theme; |
|
17 |
import com.vaadin.annotations.VaadinServletConfiguration; |
|
18 |
import com.vaadin.navigator.Navigator; |
|
19 |
import com.vaadin.server.VaadinServlet; |
|
20 |
import com.vaadin.ui.UI; |
|
21 |
|
|
22 |
import eu.etaxonomy.cdm.vaadin.view.ConceptRelationshipView; |
|
23 |
|
|
24 |
/** |
|
25 |
* @author cmathew |
|
26 |
* @date 9 Apr 2015 |
|
27 |
* |
|
28 |
*/ |
|
29 |
@Theme("edit") |
|
30 |
public class ConceptRelationshipUI extends AbstractAuthenticatedUI { |
|
31 |
|
|
32 |
Navigator navigator; |
|
33 |
|
|
34 |
private static final String FIRST_VIEW = "editcr"; |
|
35 |
|
|
36 |
private final static Logger logger = |
|
37 |
Logger.getLogger(ConceptRelationshipUI.class.getName()); |
|
38 |
|
|
39 |
@WebServlet(value = {"/app/editcr/*"}, asyncSupported = true) |
|
40 |
@VaadinServletConfiguration(productionMode = false, ui = ConceptRelationshipUI.class, widgetset = "eu.etaxonomy.cdm.vaadin.AppWidgetSet") |
|
41 |
public static class Servlet extends VaadinServlet { |
|
42 |
} |
|
43 |
|
|
44 |
@Override |
|
45 |
protected void doInit() { |
|
46 |
// FIXME: remove this when testing is done |
|
47 |
setIgnoreAuthentication(true); |
|
48 |
|
|
49 |
getPage().setTitle("Concept Relationship Editor"); |
|
50 |
ConceptRelationshipView crEditor = new ConceptRelationshipView(); |
|
51 |
UI.getCurrent().getNavigator().addView(FIRST_VIEW, crEditor); |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public String getFirstViewName() { |
|
57 |
return FIRST_VIEW; |
|
58 |
} |
|
59 |
|
|
60 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/ConceptRelationshipView.java | ||
---|---|---|
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.view; |
|
11 |
|
|
12 |
import com.vaadin.annotations.AutoGenerated; |
|
13 |
import com.vaadin.navigator.View; |
|
14 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
15 |
import com.vaadin.ui.Alignment; |
|
16 |
import com.vaadin.ui.CustomComponent; |
|
17 |
import com.vaadin.ui.HorizontalLayout; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.vaadin.component.ConceptRelationshipComposite; |
|
20 |
import eu.etaxonomy.cdm.vaadin.component.StatusComposite; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author cmathew |
|
24 |
* @date 9 Apr 2015 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class ConceptRelationshipView extends CustomComponent implements View { |
|
28 |
|
|
29 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
30 |
|
|
31 |
@AutoGenerated |
|
32 |
private HorizontalLayout mainLayout; |
|
33 |
@AutoGenerated |
|
34 |
private StatusComposite statusCompositeRight; |
|
35 |
@AutoGenerated |
|
36 |
private ConceptRelationshipComposite conceptRelationshipComposite; |
|
37 |
@AutoGenerated |
|
38 |
private StatusComposite statusCompositeLeft; |
|
39 |
/** |
|
40 |
* The constructor should first build the main layout, set the |
|
41 |
* composition root and then do any custom initialization. |
|
42 |
* |
|
43 |
* The constructor will not be automatically regenerated by the |
|
44 |
* visual editor. |
|
45 |
*/ |
|
46 |
public ConceptRelationshipView() { |
|
47 |
|
|
48 |
buildMainLayout(); |
|
49 |
setCompositionRoot(mainLayout); |
|
50 |
|
|
51 |
conceptRelationshipComposite.setSizeFull(); |
|
52 |
} |
|
53 |
|
|
54 |
/* (non-Javadoc) |
|
55 |
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) |
|
56 |
*/ |
|
57 |
@Override |
|
58 |
public void enter(ViewChangeEvent event) { |
|
59 |
// TODO Auto-generated method stub |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
@AutoGenerated |
|
64 |
private HorizontalLayout buildMainLayout() { |
|
65 |
// common part: create layout |
|
66 |
mainLayout = new HorizontalLayout(); |
|
67 |
mainLayout.setImmediate(false); |
|
68 |
mainLayout.setWidth("100%"); |
|
69 |
mainLayout.setHeight("100%"); |
|
70 |
mainLayout.setMargin(true); |
|
71 |
|
|
72 |
// top-level component properties |
|
73 |
setWidth("100.0%"); |
|
74 |
setHeight("100.0%"); |
|
75 |
|
|
76 |
// statusCompositeLeft |
|
77 |
statusCompositeLeft = new StatusComposite(); |
|
78 |
statusCompositeLeft.setImmediate(false); |
|
79 |
statusCompositeLeft.setWidth("-1px"); |
|
80 |
statusCompositeLeft.setHeight("-1px"); |
|
81 |
mainLayout.addComponent(statusCompositeLeft); |
|
82 |
|
|
83 |
// conceptRelationshipComposite |
|
84 |
conceptRelationshipComposite = new ConceptRelationshipComposite(); |
|
85 |
conceptRelationshipComposite.setImmediate(false); |
|
86 |
conceptRelationshipComposite.setWidth("-1px"); |
|
87 |
conceptRelationshipComposite.setHeight("-1px"); |
|
88 |
mainLayout.addComponent(conceptRelationshipComposite); |
|
89 |
mainLayout.setExpandRatio(conceptRelationshipComposite, 1.0f); |
|
90 |
mainLayout.setComponentAlignment(conceptRelationshipComposite, new Alignment(20)); |
|
91 |
|
|
92 |
// statusCompositeRight |
|
93 |
statusCompositeRight = new StatusComposite(); |
|
94 |
statusCompositeRight.setImmediate(false); |
|
95 |
statusCompositeRight.setWidth("-1px"); |
|
96 |
statusCompositeRight.setHeight("-1px"); |
|
97 |
mainLayout.addComponent(statusCompositeRight); |
|
98 |
|
|
99 |
return mainLayout; |
|
100 |
} |
|
101 |
|
|
102 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IConceptRelationshipComponentListener.java | ||
---|---|---|
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.view; |
|
11 |
|
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.json.JSONException; |
|
15 |
|
|
16 |
/** |
|
17 |
* @author cmathew |
|
18 |
* @date 9 Apr 2015 |
|
19 |
* |
|
20 |
*/ |
|
21 |
public interface IConceptRelationshipComponentListener { |
|
22 |
|
|
23 |
/** |
|
24 |
* @param taxonUuid |
|
25 |
* @throws JSONException |
|
26 |
*/ |
|
27 |
public void updateConceptRelationship(UUID taxonUuid) throws JSONException; |
|
28 |
|
|
29 |
} |
Also available in: Unified diff
ConceptRelationshipComposite, ConceptRelationshipPresenter, IConceptRelationshipComponentListener : composite / presenter for the new concept relationship view
D3ConceptRelationshipTree, D3ConceptRelationshipTreeState : js component + state for the concept relationship composite
ConceptRelationshipUI, ConceptRelationshipView : UI and view for concept relationship editor