Revision 08af4f8a
Added by Cherian Mathew almost 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/component/ConceptRelationshipComposite.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.vaadin.component; |
11 | 11 |
|
12 |
import java.util.UUID; |
|
13 |
|
|
12 | 14 |
import org.json.JSONException; |
13 | 15 |
|
14 | 16 |
import com.vaadin.annotations.AutoGenerated; |
... | ... | |
20 | 22 |
import com.vaadin.ui.HorizontalLayout; |
21 | 23 |
import com.vaadin.ui.Notification; |
22 | 24 |
import com.vaadin.ui.Notification.Type; |
23 |
import com.vaadin.ui.UI; |
|
24 | 25 |
import com.vaadin.ui.VerticalLayout; |
25 |
import com.vaadin.ui.Window; |
|
26 | 26 |
|
27 | 27 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
28 | 28 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree; |
29 | 29 |
import eu.etaxonomy.cdm.vaadin.presenter.ConceptRelationshipPresenter; |
30 |
import eu.etaxonomy.cdm.vaadin.session.BasicEvent; |
|
30 | 31 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
32 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action; |
|
31 | 33 |
import eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener; |
32 | 34 |
import eu.etaxonomy.cdm.vaadin.session.ISelectionListener; |
33 | 35 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
34 | 36 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
37 |
import eu.etaxonomy.cdm.vaadin.view.ConceptRelationshipView; |
|
35 | 38 |
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener; |
36 | 39 |
|
37 | 40 |
/** |
... | ... | |
59 | 62 |
private final IConceptRelationshipComponentListener listener; |
60 | 63 |
|
61 | 64 |
private IdUuidName fromTaxonIun; |
65 |
private UUID selectedTaxonRelUuid; |
|
66 |
|
|
67 |
private ConceptRelationshipView view; |
|
62 | 68 |
|
63 | 69 |
public static final String CREATE_NEW_CR_TITLE = "Create New Concept Relationship"; |
70 |
public static final String EDIT_CR_TITLE = "Edit Concept Relationship"; |
|
71 |
public static final String DELETE_CR_TITLE = "Delete Concept Relationship"; |
|
72 |
|
|
73 |
public static final String UPDATE_START_ID = "cr-update-start"; |
|
74 |
public static final String UPDATE_END_ID = "cr-update-end"; |
|
64 | 75 |
|
65 | 76 |
/** |
66 | 77 |
* The constructor should first build the main layout, set the |
... | ... | |
79 | 90 |
|
80 | 91 |
addUIListeners(); |
81 | 92 |
init(); |
82 |
|
|
83 | 93 |
} |
84 | 94 |
|
95 |
public void setView(ConceptRelationshipView view) { |
|
96 |
this.view = view; |
|
97 |
} |
|
85 | 98 |
|
86 | 99 |
private void init() { |
100 |
editButton.setEnabled(false); |
|
101 |
deleteButton.setEnabled(false); |
|
87 | 102 |
initD3ConceptRelationShipTree(); |
88 | 103 |
} |
89 | 104 |
|
90 | 105 |
private void initD3ConceptRelationShipTree() { |
91 | 106 |
d3ConceptRelationShipTree.setImmediate(true); |
107 |
d3ConceptRelationShipTree.setConceptRelComposite(this); |
|
92 | 108 |
} |
93 | 109 |
|
94 | 110 |
private void addUIListeners() { |
95 | 111 |
addNewButtonListener(); |
112 |
addEditButtonListener(); |
|
113 |
addDeleteButtonListener(); |
|
96 | 114 |
} |
97 | 115 |
|
98 | 116 |
private void addNewButtonListener() { |
... | ... | |
100 | 118 |
|
101 | 119 |
@Override |
102 | 120 |
public void buttonClick(ClickEvent event) { |
103 |
showEditConceptRelationshipWindow(CREATE_NEW_CR_TITLE, fromTaxonIun, null, null); |
|
121 |
EditConceptRelationshipComposite.showInDialog(CREATE_NEW_CR_TITLE, |
|
122 |
fromTaxonIun, |
|
123 |
null, |
|
124 |
null, |
|
125 |
Action.Create); |
|
126 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
127 |
.fireBasicEvent(new BasicEvent(UPDATE_START_ID, ConceptRelationshipComposite.class), false); |
|
128 |
} |
|
129 |
}); |
|
130 |
} |
|
131 |
|
|
132 |
private void addEditButtonListener() { |
|
133 |
editButton.addClickListener(new ClickListener() { |
|
134 |
|
|
135 |
@Override |
|
136 |
public void buttonClick(ClickEvent event) { |
|
137 |
EditConceptRelationshipComposite.showInDialog(EDIT_CR_TITLE, |
|
138 |
fromTaxonIun, |
|
139 |
selectedTaxonRelUuid, |
|
140 |
Action.Update); |
|
141 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
142 |
.fireBasicEvent(new BasicEvent(UPDATE_START_ID, ConceptRelationshipComposite.class), false); |
|
104 | 143 |
} |
105 | 144 |
}); |
106 | 145 |
} |
107 | 146 |
|
108 |
public static void showEditConceptRelationshipWindow(String windowTitle, |
|
109 |
IdUuidName fromTaxonIun, |
|
110 |
IdUuidName taxonRTypeIun, |
|
111 |
IdUuidName toTaxonIun) { |
|
112 |
Window dialog = new Window(windowTitle); |
|
113 |
dialog.setModal(false); |
|
114 |
dialog.setClosable(false); |
|
115 |
dialog.setResizable(false); |
|
116 |
UI.getCurrent().addWindow(dialog); |
|
147 |
private void addDeleteButtonListener() { |
|
148 |
deleteButton.addClickListener(new ClickListener() { |
|
117 | 149 |
|
118 |
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(dialog,fromTaxonIun, taxonRTypeIun, toTaxonIun); |
|
119 |
dialog.setContent(ecrc); |
|
150 |
@Override |
|
151 |
public void buttonClick(ClickEvent event) { |
|
152 |
EditConceptRelationshipComposite.showInDialog(DELETE_CR_TITLE, |
|
153 |
fromTaxonIun, |
|
154 |
selectedTaxonRelUuid, |
|
155 |
Action.Delete); |
|
156 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
157 |
.fireBasicEvent(new BasicEvent(UPDATE_START_ID, ConceptRelationshipComposite.class), false); |
|
158 |
} |
|
159 |
}); |
|
120 | 160 |
} |
121 | 161 |
|
162 |
|
|
122 | 163 |
private void refreshRelationshipView() { |
123 | 164 |
if(fromTaxonIun != null) { |
124 | 165 |
try { |
... | ... | |
129 | 170 |
} |
130 | 171 |
} |
131 | 172 |
|
173 |
public void setSelectedTaxonRelUuid(UUID selectedTaxonRelUuid) { |
|
174 |
this.selectedTaxonRelUuid = selectedTaxonRelUuid; |
|
175 |
if(selectedTaxonRelUuid == null) { |
|
176 |
editButton.setEnabled(false); |
|
177 |
deleteButton.setEnabled(false); |
|
178 |
} else { |
|
179 |
editButton.setEnabled(true); |
|
180 |
deleteButton.setEnabled(true); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
132 | 184 |
/* (non-Javadoc) |
133 | 185 |
* @see eu.etaxonomy.cdm.vaadin.session.ISelectionListener#onSelect(eu.etaxonomy.cdm.vaadin.session.SelectionEvent) |
134 | 186 |
*/ |
... | ... | |
136 | 188 |
public void onSelect(SelectionEvent event) { |
137 | 189 |
if(event.getSourceType().equals(StatusComposite.class)) { |
138 | 190 |
fromTaxonIun = (IdUuidName)event.getSelectedObjects().get(0); |
191 |
view.setPrimaryStatusComposite((UUID)event.getSelectedObjects().get(1)); |
|
139 | 192 |
refreshRelationshipView(); |
140 | 193 |
} |
141 |
|
|
142 | 194 |
} |
143 | 195 |
|
144 | 196 |
|
... | ... | |
149 | 201 |
@Override |
150 | 202 |
public void onCreate(CdmChangeEvent event) { |
151 | 203 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
204 |
setSelectedTaxonRelUuid(null); |
|
152 | 205 |
refreshRelationshipView(); |
206 |
|
|
153 | 207 |
} |
154 | 208 |
|
155 | 209 |
} |
... | ... | |
160 | 214 |
*/ |
161 | 215 |
@Override |
162 | 216 |
public void onUpdate(CdmChangeEvent event) { |
163 |
// TODO Auto-generated method stub |
|
217 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
|
218 |
setSelectedTaxonRelUuid(null); |
|
219 |
refreshRelationshipView(); |
|
220 |
} |
|
164 | 221 |
|
165 | 222 |
} |
166 | 223 |
|
... | ... | |
170 | 227 |
*/ |
171 | 228 |
@Override |
172 | 229 |
public void onDelete(CdmChangeEvent event) { |
173 |
// TODO Auto-generated method stub |
|
230 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
|
231 |
setSelectedTaxonRelUuid(null); |
|
232 |
refreshRelationshipView(); |
|
233 |
} |
|
174 | 234 |
|
175 | 235 |
} |
176 | 236 |
@AutoGenerated |
src/main/java/eu/etaxonomy/cdm/vaadin/component/EditConceptRelationshipComposite.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 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 |
*/ |
|
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 | 10 |
package eu.etaxonomy.cdm.vaadin.component; |
11 | 11 |
|
12 | 12 |
import java.sql.SQLException; |
13 | 13 |
import java.util.Arrays; |
14 |
import java.util.Map; |
|
14 | 15 |
import java.util.UUID; |
15 | 16 |
|
16 | 17 |
import com.vaadin.annotations.AutoGenerated; |
17 | 18 |
import com.vaadin.data.Container.Hierarchical; |
18 | 19 |
import com.vaadin.data.Validator.EmptyValueException; |
20 |
import com.vaadin.data.util.sqlcontainer.RowId; |
|
19 | 21 |
import com.vaadin.event.Transferable; |
20 | 22 |
import com.vaadin.event.dd.DragAndDropEvent; |
21 | 23 |
import com.vaadin.event.dd.DropHandler; |
... | ... | |
42 | 44 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
43 | 45 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
44 | 46 |
import eu.etaxonomy.cdm.vaadin.presenter.EditConceptRelationshipPresenter; |
47 |
import eu.etaxonomy.cdm.vaadin.session.BasicEvent; |
|
45 | 48 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
46 | 49 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action; |
47 | 50 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation; |
51 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
48 | 52 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
49 | 53 |
|
50 | 54 |
/** |
... | ... | |
87 | 91 |
|
88 | 92 |
private final EditConceptRelationshipPresenter presenter; |
89 | 93 |
|
90 |
private IdUuidName fromTaxonIdUuidName, taxonRTypeIdUuidName, toTaxonIdUuidName;
|
|
91 |
|
|
92 |
private final Window dialog;
|
|
94 |
private IdUuidName fromTaxonIun, taxonRTypeIun, toTaxonIun;
|
|
95 |
private UUID relUuid; |
|
96 |
private Window window;
|
|
93 | 97 |
|
94 | 98 |
private final static String CHOOSE_TREL_TYPE = "Choose Type ..."; |
95 | 99 |
private final static String DRAG_TAXON_HINT = "Drag Taxon here ..."; |
96 | 100 |
|
101 |
|
|
102 |
private Action action; |
|
103 |
|
|
104 |
public EditConceptRelationshipComposite(IdUuidName fromTaxonIdUuidName, |
|
105 |
IdUuidName taxonRTypeIdUuidName, |
|
106 |
IdUuidName toTaxonIdUuidName, |
|
107 |
Action action) { |
|
108 |
this(); |
|
109 |
init(fromTaxonIdUuidName, taxonRTypeIdUuidName, toTaxonIdUuidName, action); |
|
110 |
|
|
111 |
} |
|
112 |
|
|
113 |
public EditConceptRelationshipComposite(IdUuidName fromTaxonIun, |
|
114 |
UUID relUuid, |
|
115 |
Action action) { |
|
116 |
this(); |
|
117 |
this.relUuid = relUuid; |
|
118 |
Map<String, IdUuidName> map = presenter.getRelTypeToTaxonIunMap(fromTaxonIun.getUuid(), relUuid); |
|
119 |
taxonRTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY); |
|
120 |
toTaxonIun = map.get(EditConceptRelationshipPresenter.TO_TAXON_KEY); |
|
121 |
init(fromTaxonIun, taxonRTypeIun, toTaxonIun, action); |
|
122 |
|
|
123 |
} |
|
97 | 124 |
/** |
98 | 125 |
* The constructor should first build the main layout, set the |
99 | 126 |
* composition root and then do any custom initialization. |
... | ... | |
101 | 128 |
* The constructor will not be automatically regenerated by the |
102 | 129 |
* visual editor. |
103 | 130 |
*/ |
104 |
public EditConceptRelationshipComposite(Window dialog, |
|
105 |
IdUuidName fromTaxonIdUuidName, |
|
106 |
IdUuidName taxonRTypeIdUuidName, |
|
107 |
IdUuidName toTaxonIdUuidName) { |
|
131 |
public EditConceptRelationshipComposite() { |
|
108 | 132 |
|
109 | 133 |
buildMainLayout(); |
110 | 134 |
buildToTaxon(); |
111 | 135 |
setCompositionRoot(mainLayout); |
112 | 136 |
|
113 | 137 |
this.presenter = new EditConceptRelationshipPresenter(); |
114 |
this.dialog = dialog; |
|
115 |
this.fromTaxonIdUuidName = fromTaxonIdUuidName; |
|
116 |
this.taxonRTypeIdUuidName = taxonRTypeIdUuidName; |
|
117 |
this.toTaxonIdUuidName = toTaxonIdUuidName; |
|
118 |
|
|
119 | 138 |
addUIListeners(); |
120 |
init(); |
|
139 |
|
|
121 | 140 |
} |
122 | 141 |
|
123 |
private void init() { |
|
142 |
public void init(IdUuidName fromTaxonIdUuidName, |
|
143 |
IdUuidName taxonRTypeIdUuidName, |
|
144 |
IdUuidName toTaxonIdUuidName, |
|
145 |
Action action) { |
|
146 |
|
|
147 |
this.fromTaxonIun = fromTaxonIdUuidName; |
|
148 |
this.taxonRTypeIun = taxonRTypeIdUuidName; |
|
149 |
this.toTaxonIun = toTaxonIdUuidName; |
|
150 |
this.action = action; |
|
151 |
|
|
124 | 152 |
initFromTaxonLabel(); |
125 | 153 |
initConceptRComboBox(); |
126 | 154 |
initToTaxon(); |
127 | 155 |
} |
128 | 156 |
|
157 |
public void setWindow(Window window) { |
|
158 |
this.window = window; |
|
159 |
} |
|
129 | 160 |
private void initFromTaxonLabel() { |
130 |
fromTaxonValue.setValue(fromTaxonIdUuidName.getName());
|
|
161 |
fromTaxonValue.setValue(fromTaxonIun.getName());
|
|
131 | 162 |
} |
132 | 163 |
|
133 | 164 |
private void initConceptRComboBox() { |
134 | 165 |
conceptRComboBox.setImmediate(true); |
135 |
|
|
136 | 166 |
conceptRComboBox.setItemCaptionPropertyId("titleCache"); |
137 | 167 |
try { |
138 | 168 |
conceptRComboBox.setContainerDataSource(presenter.loadTaxonRelationshipTypeContainer()); |
... | ... | |
140 | 170 |
// TODO Auto-generated catch block |
141 | 171 |
e.printStackTrace(); |
142 | 172 |
} |
143 |
if(taxonRTypeIdUuidName == null) {
|
|
173 |
if(taxonRTypeIun == null) {
|
|
144 | 174 |
conceptRComboBox.setInputPrompt(CHOOSE_TREL_TYPE); |
145 | 175 |
} else { |
146 |
conceptRComboBox.setValue(taxonRTypeIdUuidName.getId()); |
|
176 |
conceptRComboBox.setValue(new RowId(taxonRTypeIun.getId())); |
|
177 |
} |
|
178 |
|
|
179 |
if(action == Action.Delete) { |
|
180 |
conceptRComboBox.setReadOnly(true); |
|
181 |
saveButton.setCaption("ok"); |
|
147 | 182 |
} |
148 | 183 |
} |
149 | 184 |
|
... | ... | |
153 | 188 |
toTaxonLayoutWrapper.setImmediate(false); |
154 | 189 |
toTaxonLayoutWrapper.setWidth("-1px"); |
155 | 190 |
toTaxonLayoutWrapper.setHeight("-1px"); |
191 |
toTaxonTextField.setReadOnly(true); |
|
156 | 192 |
|
157 | 193 |
toTaxonLayoutWrapper.setDropHandler(new DropHandler() { |
158 | 194 |
|
... | ... | |
167 | 203 |
Transferable t = event.getTransferable(); |
168 | 204 |
|
169 | 205 |
// Make sure the drag source is a status composite tree table |
170 |
if (t.getSourceComponent() instanceof TreeTable) { |
|
206 |
if (action != Action.Delete && t.getSourceComponent() instanceof TreeTable) {
|
|
171 | 207 |
TreeTable table = (TreeTable)t.getSourceComponent(); |
172 | 208 |
Hierarchical containerDataSource = table.getContainerDataSource(); |
173 | 209 |
if(containerDataSource instanceof LeafNodeTaxonContainer) { |
174 | 210 |
LeafNodeTaxonContainer lntc = (LeafNodeTaxonContainer)containerDataSource; |
175 | 211 |
Object sourceItemId = t.getData("itemId"); |
176 | 212 |
String toName = (String)lntc.getProperty(sourceItemId, LeafNodeTaxonContainer.NAME_ID).getValue(); |
177 |
toTaxonIdUuidName = new IdUuidName(sourceItemId,
|
|
213 |
toTaxonIun = new IdUuidName(sourceItemId,
|
|
178 | 214 |
lntc.getUuid(sourceItemId), |
179 | 215 |
toName); |
216 |
toTaxonTextField.setReadOnly(false); |
|
180 | 217 |
toTaxonTextField.setValue(toName); |
218 |
toTaxonTextField.setReadOnly(true); |
|
181 | 219 |
} |
182 | 220 |
} |
183 | 221 |
} |
184 | 222 |
}); |
185 |
|
|
186 | 223 |
horizontalLayout.addComponent(toTaxonLayoutWrapper); |
187 | 224 |
horizontalLayout.setComponentAlignment(toTaxonLayoutWrapper, new Alignment(48)); |
188 | 225 |
|
189 | 226 |
} |
190 | 227 |
|
191 | 228 |
private void initToTaxon() { |
192 |
if(toTaxonIdUuidName == null) { |
|
229 |
toTaxonTextField.setReadOnly(false); |
|
230 |
if(toTaxonIun == null) { |
|
193 | 231 |
toTaxonTextField.setValue(DRAG_TAXON_HINT); |
194 | 232 |
} else { |
195 |
toTaxonTextField.setValue(toTaxonIdUuidName.getName());
|
|
233 |
toTaxonTextField.setValue(toTaxonIun.getName());
|
|
196 | 234 |
} |
235 |
toTaxonTextField.setReadOnly(true); |
|
197 | 236 |
} |
198 | 237 |
|
199 | 238 |
private void addUIListeners() { |
... | ... | |
212 | 251 |
try { |
213 | 252 |
conceptRComboBox.validate(); |
214 | 253 |
toTaxonTextField.validate(); |
254 |
if(toTaxonIun == null) { |
|
255 |
// FIXME: Not efficient - figure out a way |
|
256 |
// of validation including the null check |
|
257 |
throw new EmptyValueException(""); |
|
258 |
} |
|
215 | 259 |
} catch (EmptyValueException e) { |
216 | 260 |
Notification notification = new Notification("Invalid input", "Neither Relationship Type nor To Taxon can be empty", Type.WARNING_MESSAGE); |
217 | 261 |
notification.setDelayMsec(2000); |
... | ... | |
221 | 265 |
|
222 | 266 |
CdmVaadinUtilities.setEnabled(mainLayout, false, null); |
223 | 267 |
|
224 |
CdmVaadinUtilities.exec(new CdmVaadinOperation(500, cdmProgressComponent) { |
|
225 |
@Override |
|
226 |
public boolean execute() { |
|
227 |
setProgress("Saving New Concept Relationship"); |
|
228 |
UUID relTypeUuid = presenter.getTaxonRTypeContainer().getUuid(conceptRComboBox.getValue()); |
|
229 |
presenter.createRelationship(fromTaxonIdUuidName.getUuid(), relTypeUuid, toTaxonIdUuidName.getUuid()); |
|
230 |
fireEvent(new CdmChangeEvent(Action.Create, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
231 |
return true; |
|
232 |
} |
|
268 |
try { |
|
269 |
CdmVaadinUtilities.exec(new CdmVaadinOperation(200, cdmProgressComponent) { |
|
270 |
@Override |
|
271 |
public boolean execute() { |
|
272 |
UUID relTypeUuid = presenter.getTaxonRTypeContainer().getUuid(conceptRComboBox.getValue()); |
|
273 |
switch(action) { |
|
274 |
case Create: |
|
275 |
setProgress("Saving New Concept Relationship"); |
|
276 |
presenter.createRelationship(fromTaxonIun.getUuid(), relTypeUuid, toTaxonIun.getUuid()); |
|
277 |
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
278 |
break; |
|
279 |
case Update: |
|
280 |
setProgress("Update Concept Relationship"); |
|
281 |
presenter.updateRelationship(fromTaxonIun.getUuid(), relUuid, relTypeUuid, toTaxonIun.getUuid()); |
|
282 |
registerDelayedEvent(new CdmChangeEvent(Action.Update, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
283 |
break; |
|
284 |
case Delete: |
|
285 |
setProgress("Deleting Concept Relationship"); |
|
286 |
presenter.deleteRelationship(fromTaxonIun.getUuid(), relUuid); |
|
287 |
registerDelayedEvent(new CdmChangeEvent(Action.Delete, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
288 |
break; |
|
289 |
default: |
|
290 |
|
|
291 |
} |
|
292 |
return true; |
|
293 |
} |
|
233 | 294 |
|
234 |
@Override |
|
235 |
public void postOpUIUpdate(boolean success) { |
|
236 |
if(success) { |
|
237 |
UI.getCurrent().removeWindow(dialog); |
|
238 |
} else { |
|
239 |
CdmVaadinUtilities.setEnabled(mainLayout, true, null); |
|
295 |
@Override |
|
296 |
public void postOpUIUpdate(boolean success) { |
|
297 |
if(success) { |
|
298 |
if(window != null) { |
|
299 |
UI.getCurrent().removeWindow(window); |
|
300 |
} |
|
301 |
} else { |
|
302 |
CdmVaadinUtilities.setEnabled(mainLayout, true, null); |
|
303 |
} |
|
240 | 304 |
} |
241 |
} |
|
242 |
}); |
|
305 |
}); |
|
306 |
} finally { |
|
307 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
308 |
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), false); |
|
309 |
} |
|
243 | 310 |
} |
244 | 311 |
}); |
245 | 312 |
} |
... | ... | |
249 | 316 |
|
250 | 317 |
@Override |
251 | 318 |
public void buttonClick(ClickEvent event) { |
252 |
UI.getCurrent().removeWindow(dialog); |
|
253 |
|
|
319 |
if(window != null) { |
|
320 |
UI.getCurrent().removeWindow(window); |
|
321 |
} |
|
322 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
323 |
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), true); |
|
254 | 324 |
} |
255 | 325 |
}); |
256 | 326 |
} |
257 | 327 |
|
258 | 328 |
|
329 |
private static void showInDialog(String windowTitle, |
|
330 |
EditConceptRelationshipComposite ecrc) { |
|
331 |
Window dialog = new Window(windowTitle); |
|
332 |
dialog.setModal(false); |
|
333 |
dialog.setClosable(false); |
|
334 |
dialog.setResizable(false); |
|
335 |
UI.getCurrent().addWindow(dialog); |
|
336 |
ecrc.setWindow(dialog); |
|
337 |
dialog.setContent(ecrc); |
|
338 |
} |
|
339 |
|
|
340 |
public static void showInDialog(String windowTitle, |
|
341 |
IdUuidName fromTaxonIun, |
|
342 |
IdUuidName taxonRTypeIun, |
|
343 |
IdUuidName toTaxonIun, |
|
344 |
Action action) { |
|
345 |
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action); |
|
346 |
showInDialog(windowTitle, ecrc); |
|
347 |
} |
|
348 |
|
|
349 |
public static void showInDialog(String windowTitle, |
|
350 |
IdUuidName fromTaxonIun, |
|
351 |
UUID relUuid, |
|
352 |
Action action) { |
|
353 |
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, relUuid,action); |
|
354 |
showInDialog(windowTitle, ecrc); |
|
355 |
} |
|
356 |
|
|
259 | 357 |
private VerticalLayout buildToTaxonVLayout() { |
260 | 358 |
// common part: create layout |
261 | 359 |
toTaxonVLayout = new VerticalLayout(); |
src/main/java/eu/etaxonomy/cdm/vaadin/component/NewTaxonBaseComposite.java | ||
---|---|---|
137 | 137 |
|
138 | 138 |
@Override |
139 | 139 |
public void buttonClick(ClickEvent event) { |
140 |
|
|
141 |
|
|
142 | 140 |
try { |
143 | 141 |
nameTextField.validate(); |
144 | 142 |
secComboBox.validate(); |
... | ... | |
161 | 159 |
} else { |
162 | 160 |
taxonBaseIdUuid = listener.newSynonym(nameTextField.getValue(),secComboBox.getValue(), accTaxonIdUuid.getUuid()); |
163 | 161 |
} |
164 |
|
|
165 | 162 |
Object rowId = new RowId(taxonBaseIdUuid.getId()); |
166 |
fireEvent(new CdmChangeEvent(Action.Create, Arrays.asList(rowId), NewTaxonBaseComposite.class)); |
|
167 |
|
|
163 |
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList(rowId), NewTaxonBaseComposite.class)); |
|
168 | 164 |
return true; |
169 | 165 |
} |
170 | 166 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/component/StatusComposite.java | ||
---|---|---|
71 | 71 |
import eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener; |
72 | 72 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
73 | 73 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
74 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
|
74 | 75 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite; |
75 | 76 |
|
76 | 77 |
/** |
... | ... | |
134 | 135 |
private static final String FILTER_TAXA_INPUT = "Filter Taxa ..."; |
135 | 136 |
private static final String IN_VIEW_PREFIX = "in view : "; |
136 | 137 |
|
138 |
private boolean isTaxaTableInitialised = false; |
|
139 |
private boolean isFiltertableInitialised = false; |
|
140 |
|
|
137 | 141 |
/** |
138 | 142 |
* The constructor should first build the main layout, set the |
139 | 143 |
* composition root and then do any custom initialization. |
... | ... | |
157 | 161 |
init(); |
158 | 162 |
} |
159 | 163 |
|
160 |
public void minimalize() { |
|
161 | 164 |
|
162 |
} |
|
165 |
|
|
163 | 166 |
|
164 | 167 |
public void init() { |
168 |
taxaTreeTable.setSelectable(true); |
|
169 |
|
|
165 | 170 |
initClassificationComboBox(); |
171 |
} |
|
166 | 172 |
|
173 |
public void setEnabledAll(boolean enabled) { |
|
174 |
CdmVaadinUtilities.setEnabled(mainLayout, enabled, Arrays.asList(classificationComboBox)); |
|
167 | 175 |
} |
168 | 176 |
|
169 |
public void setEnabledAll(boolean enable) { |
|
170 |
filterLabel.setEnabled(enable); |
|
171 |
filterTable.setEnabled(enable); |
|
172 |
taxaTreeTable.setEnabled(enable); |
|
173 |
addComboBox.setEnabled(enable); |
|
174 |
removeButton.setEnabled(enable); |
|
175 |
searchTextField.setEnabled(enable); |
|
176 |
clearSearchButton.setEnabled(enable); |
|
177 |
|
|
178 |
public void setTaxaTableEnabled(boolean enabled) { |
|
179 |
taxaTreeTable.setEnabled(enabled); |
|
177 | 180 |
} |
178 | 181 |
|
182 |
public void setTaxaTableSelectable(boolean isTaxaTableSelectable) { |
|
183 |
taxaTreeTable.setSelectable(isTaxaTableSelectable); |
|
184 |
} |
|
179 | 185 |
|
186 |
public void clearTaxaTableSelections() { |
|
187 |
taxaTreeTable.setValue(null); |
|
188 |
} |
|
180 | 189 |
|
190 |
public UUID getSelectedClassificationUuid() { |
|
191 |
if(classificationComboBox.getValue() != null) { |
|
192 |
return listener.getClassificationContainer().getUuid(classificationComboBox.getValue()); |
|
193 |
} |
|
194 |
return null; |
|
195 |
} |
|
181 | 196 |
|
182 | 197 |
private void initTaxaTable(int classificationId) { |
183 |
|
|
184 |
taxaTreeTable.setSelectable(true); |
|
185 | 198 |
taxaTreeTable.setMultiSelect(taxaTreeTableMultiSelectMode); |
186 | 199 |
taxaTreeTable.setImmediate(false); |
187 | 200 |
taxaTreeTable.setDragMode(TableDragMode.ROW); |
... | ... | |
192 | 205 |
columnIds.add(LeafNodeTaxonContainer.PB_ID); |
193 | 206 |
taxaTreeTable.setColumnWidth(LeafNodeTaxonContainer.PB_ID, 25); |
194 | 207 |
|
195 |
taxaTreeTable.addGeneratedColumn(LeafNodeTaxonContainer.PB_ID, new TaxonTableCheckBoxGenerator()); |
|
208 |
if(!isTaxaTableInitialised) { |
|
209 |
taxaTreeTable.addGeneratedColumn(LeafNodeTaxonContainer.PB_ID, new TaxonTableCheckBoxGenerator()); |
|
210 |
} |
|
211 |
|
|
196 | 212 |
try { |
197 | 213 |
taxaTreeTable.setContainerDataSource(listener.loadTaxa(classificationId), columnIds); |
198 | 214 |
} catch (SQLException e) { |
... | ... | |
252 | 268 |
toTaxonIun = new IdUuidName(targetItemId, |
253 | 269 |
listener.getCurrentLeafNodeTaxonContainer().getUuid(targetItemId), |
254 | 270 |
toName); |
255 |
ConceptRelationshipComposite.showEditConceptRelationshipWindow(ConceptRelationshipComposite.CREATE_NEW_CR_TITLE,
|
|
271 |
EditConceptRelationshipComposite.showInDialog(ConceptRelationshipComposite.CREATE_NEW_CR_TITLE,
|
|
256 | 272 |
fromTaxonIun, |
257 | 273 |
null, |
258 |
toTaxonIun); |
|
274 |
toTaxonIun, |
|
275 |
CdmChangeEvent.Action.Create); |
|
259 | 276 |
} |
260 | 277 |
} |
261 | 278 |
|
... | ... | |
267 | 284 |
// in the case of 'Table' this is not required |
268 | 285 |
listener.refresh(); |
269 | 286 |
updateInViewLabel(); |
287 |
isTaxaTableInitialised = true; |
|
270 | 288 |
} |
271 | 289 |
|
272 | 290 |
|
... | ... | |
361 | 379 |
updateInViewLabel(); |
362 | 380 |
} |
363 | 381 |
} |
382 |
}; |
|
364 | 383 |
|
384 |
if(!isFiltertableInitialised) { |
|
385 |
filterTable.addGeneratedColumn(PROPERTY_SELECTED_ID, new CheckBoxGenerator(selectedListener)); |
|
386 |
} |
|
365 | 387 |
|
366 |
}; |
|
367 |
filterTable.addGeneratedColumn(PROPERTY_SELECTED_ID, new CheckBoxGenerator(selectedListener)); |
|
388 |
isFiltertableInitialised = true; |
|
368 | 389 |
|
369 | 390 |
} |
370 | 391 |
|
... | ... | |
392 | 413 |
clearSearchButton.setCaption(""); |
393 | 414 |
} |
394 | 415 |
|
416 |
|
|
395 | 417 |
private void addUIListeners() { |
396 | 418 |
|
397 | 419 |
searchHorizontalLayout.addLayoutClickListener(new LayoutClickListener() { |
... | ... | |
434 | 456 |
|
435 | 457 |
private void addTaxaTreeTableListener() { |
436 | 458 |
taxaTreeTable.addItemClickListener(new ItemClickListener() { |
437 |
|
|
438 | 459 |
@Override |
439 | 460 |
public void itemClick(ItemClickEvent event) { |
440 |
|
|
441 | 461 |
Object itemId = event.getItemId(); |
442 |
if(!listener.isSynonym(itemId)) { |
|
443 |
UUID taxonUuid = listener.getCurrentLeafNodeTaxonContainer().getUuid(itemId); |
|
444 |
String taxonName = (String)listener.getCurrentLeafNodeTaxonContainer().getProperty(itemId, LeafNodeTaxonContainer.NAME_ID).getValue(); |
|
445 |
Object idUuidName = new IdUuidName(itemId, taxonUuid, taxonName); |
|
446 |
CdmVaadinSessionUtilities.getCurrentSelectionService() |
|
447 |
.fireSelectionEvent(new SelectionEvent(Arrays.asList(idUuidName), StatusComposite.class), true); |
|
462 |
if(taxaTreeTable.isSelectable()) { |
|
463 |
if(!listener.isSynonym(itemId)) { |
|
464 |
UUID taxonUuid = listener.getCurrentLeafNodeTaxonContainer().getUuid(itemId); |
|
465 |
String taxonName = (String)listener.getCurrentLeafNodeTaxonContainer().getProperty(itemId, LeafNodeTaxonContainer.NAME_ID).getValue(); |
|
466 |
Object idUuidName = new IdUuidName(itemId, taxonUuid, taxonName); |
|
467 |
CdmVaadinSessionUtilities.getCurrentSelectionService() |
|
468 |
.fireSelectionEvent(new SelectionEvent(Arrays.asList(idUuidName, getSelectedClassificationUuid()), StatusComposite.class), true); |
|
469 |
} |
|
470 |
taxaTreeTable.setValue(itemId); |
|
448 | 471 |
} |
449 |
taxaTreeTable.setValue(itemId); |
|
450 | 472 |
} |
451 | 473 |
}); |
452 |
|
|
453 |
|
|
454 |
|
|
455 | 474 |
} |
456 | 475 |
|
457 | 476 |
private void addAddComboBoxListener() { |
... | ... | |
561 | 580 |
|
562 | 581 |
private void addRemoveButtonListener() { |
563 | 582 |
removeButton.addClickListener(new Button.ClickListener() { |
564 |
|
|
565 | 583 |
@Override |
566 | 584 |
public void buttonClick(ClickEvent event) { |
567 | 585 |
Set<Object> selectedItemIds = (Set)taxaTreeTable.getValue(); |
... | ... | |
571 | 589 |
Notification.show("Deleting selected Taxa / Synonyms", "Implement me", Type.WARNING_MESSAGE); |
572 | 590 |
} |
573 | 591 |
} |
574 |
|
|
575 | 592 |
}); |
576 | 593 |
} |
577 | 594 |
|
... | ... | |
642 | 659 |
} else { |
643 | 660 |
return null; |
644 | 661 |
} |
645 |
|
|
646 | 662 |
} |
647 | 663 |
} |
648 | 664 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/container/CdmSQLContainer.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public CdmSQLContainer(QueryDelegate delegate) throws SQLException { |
29 | 29 |
super(delegate); |
30 |
databaseMetaData = CdmSpringContextHelper.getCurrent().getConnection().getMetaData();
|
|
30 |
databaseMetaData = CdmSpringContextHelper.getCurrent().getDatabaseMetaData();
|
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
public static CdmSQLContainer newInstance(String tableName) throws SQLException { |
src/main/java/eu/etaxonomy/cdm/vaadin/jscomponent/D3ConceptRelationshipTree.java | ||
---|---|---|
14 | 14 |
import java.util.List; |
15 | 15 |
import java.util.Map; |
16 | 16 |
import java.util.Set; |
17 |
import java.util.UUID; |
|
17 | 18 |
|
18 | 19 |
import org.apache.log4j.Logger; |
19 | 20 |
import org.json.JSONArray; |
... | ... | |
24 | 25 |
import com.vaadin.annotations.StyleSheet; |
25 | 26 |
import com.vaadin.ui.AbstractJavaScriptComponent; |
26 | 27 |
import com.vaadin.ui.JavaScriptFunction; |
27 |
import com.vaadin.ui.Notification; |
|
28 |
import com.vaadin.ui.Notification.Type; |
|
29 | 28 |
|
30 | 29 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
31 | 30 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
32 | 31 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
32 |
import eu.etaxonomy.cdm.vaadin.component.ConceptRelationshipComposite; |
|
33 | 33 |
|
34 | 34 |
/** |
35 | 35 |
* @author cmathew |
... | ... | |
42 | 42 |
|
43 | 43 |
private static final Logger logger = Logger.getLogger(D3ConceptRelationshipTree.class); |
44 | 44 |
|
45 |
public enum Mode { |
|
46 |
OneToOne, |
|
47 |
Group |
|
48 |
} |
|
49 |
|
|
50 |
private Mode mode; |
|
51 |
|
|
52 |
private ConceptRelationshipComposite conceptRelComposite; |
|
53 |
|
|
45 | 54 |
public D3ConceptRelationshipTree() { |
46 |
addFunction("test", new JavaScriptFunction() { |
|
55 |
this(Mode.OneToOne); |
|
56 |
} |
|
57 |
|
|
58 |
public D3ConceptRelationshipTree(Mode mode) { |
|
59 |
this.mode = mode; |
|
60 |
|
|
61 |
addFunction("select", new JavaScriptFunction() { |
|
47 | 62 |
|
48 | 63 |
@Override |
49 | 64 |
public void call(JSONArray arguments) throws JSONException { |
50 |
Notification.show("Store selected","uuid : " + arguments.getString(0), Type.WARNING_MESSAGE); |
|
65 |
//Notification.show("Store selected","uuid : " + arguments.getJSONObject(0).getString("uuid"), Type.WARNING_MESSAGE); |
|
66 |
if(conceptRelComposite != null) { |
|
67 |
UUID relUuid = UUID.fromString(arguments.getString(0)); |
|
68 |
conceptRelComposite.setSelectedTaxonRelUuid(relUuid); |
|
69 |
} |
|
51 | 70 |
} |
52 | 71 |
}); |
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 | 72 |
setConceptRelationshipTree(""); |
56 | 73 |
|
57 | 74 |
} |
58 | 75 |
|
76 |
public void setConceptRelComposite(ConceptRelationshipComposite conceptRelComposite) { |
|
77 |
this.conceptRelComposite = conceptRelComposite; |
|
78 |
} |
|
79 |
|
|
59 | 80 |
|
60 | 81 |
public void update(Taxon fromTaxon) throws JSONException { |
82 |
switch(mode) { |
|
83 |
case OneToOne: |
|
84 |
updateForOneToOne(fromTaxon); |
|
85 |
break; |
|
86 |
case Group: |
|
87 |
updateForGroup(fromTaxon); |
|
88 |
break; |
|
89 |
default: |
|
90 |
updateForOneToOne(fromTaxon); |
|
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
private void updateForOneToOne(Taxon fromTaxon) throws JSONException { |
|
95 |
Set<TaxonRelationship> relationsFromThisTaxon = fromTaxon.getRelationsFromThisTaxon(); |
|
96 |
|
|
97 |
Map<TaxonRelationshipType, List<Taxon>> relToTaxonMap = new HashMap<TaxonRelationshipType, List<Taxon>>(); |
|
98 |
|
|
99 |
|
|
100 |
JSONObject fromTaxonJO = new JSONObject(); |
|
101 |
fromTaxonJO.put("name", fromTaxon.getName().getTitleCache()); |
|
102 |
fromTaxonJO.put("uuid", fromTaxon.getUuid().toString()); |
|
103 |
fromTaxonJO.put("type", "taxon"); |
|
104 |
|
|
105 |
JSONArray ftChildren = new JSONArray(); |
|
106 |
fromTaxonJO.put("children", ftChildren); |
|
107 |
|
|
108 |
int typeIndex = 0; |
|
109 |
if(relationsFromThisTaxon !=null && !relationsFromThisTaxon.isEmpty()) { |
|
110 |
for(TaxonRelationship tr : relationsFromThisTaxon) { |
|
111 |
if(tr != null && fromTaxon.equals(tr.getFromTaxon())) { |
|
112 |
|
|
113 |
|
|
114 |
JSONObject crJO = new JSONObject(); |
|
115 |
crJO.put("name", tr.getType().getTitleCache()); |
|
116 |
crJO.put("uuid", tr.getUuid()); |
|
117 |
crJO.put("type", "conceptr"); |
|
118 |
|
|
119 |
ftChildren.put(typeIndex, crJO); |
|
120 |
|
|
121 |
JSONArray crChildrenJA = new JSONArray(); |
|
122 |
crJO.put("children", crChildrenJA); |
|
123 |
|
|
124 |
Taxon toTaxon = tr.getToTaxon(); |
|
125 |
|
|
126 |
JSONObject toTaxonJO = new JSONObject(); |
|
127 |
toTaxonJO.put("name", toTaxon.getName().getTitleCache()); |
|
128 |
toTaxonJO.put("uuid", toTaxon.getUuid()); |
|
129 |
toTaxonJO.put("type", "taxon"); |
|
130 |
|
|
131 |
crChildrenJA.put(0, toTaxonJO); |
|
132 |
typeIndex++; |
|
133 |
} |
|
134 |
} |
|
135 |
} |
|
136 |
setConceptRelationshipTree(fromTaxonJO.toString()); |
|
137 |
} |
|
138 |
|
|
139 |
private void updateForGroup(Taxon fromTaxon) throws JSONException { |
|
61 | 140 |
Set<TaxonRelationship> relationsFromThisTaxon = fromTaxon.getRelationsFromThisTaxon(); |
62 | 141 |
|
63 | 142 |
Map<TaxonRelationshipType, List<Taxon>> relToTaxonMap = new HashMap<TaxonRelationshipType, List<Taxon>>(); |
... | ... | |
67 | 146 |
fromTaxonJO.put("name", fromTaxon.getTitleCache()); |
68 | 147 |
fromTaxonJO.put("uuid", fromTaxon.getUuid().toString()); |
69 | 148 |
|
149 |
|
|
70 | 150 |
if(relationsFromThisTaxon !=null && !relationsFromThisTaxon.isEmpty()) { |
71 | 151 |
for(TaxonRelationship tr : relationsFromThisTaxon) { |
72 | 152 |
if(fromTaxon.equals(tr.getFromTaxon())) { |
... | ... | |
106 | 186 |
typeIndex++; |
107 | 187 |
} |
108 | 188 |
} |
109 |
|
|
110 |
|
|
111 | 189 |
setConceptRelationshipTree(fromTaxonJO.toString()); |
112 | 190 |
} |
113 | 191 |
|
192 |
|
|
114 | 193 |
public void setConceptRelationshipTree(String conceptRelationshipTree) { |
115 | 194 |
getState().setConceptRelationshipTree(conceptRelationshipTree);; |
116 | 195 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/ConceptRelationshipPresenter.java | ||
---|---|---|
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
|
54 |
|
|
54 | 55 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/EditConceptRelationshipPresenter.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.vaadin.presenter; |
11 | 11 |
|
12 | 12 |
import java.sql.SQLException; |
13 |
import java.util.HashMap; |
|
14 |
import java.util.Map; |
|
13 | 15 |
import java.util.Set; |
14 | 16 |
import java.util.UUID; |
15 | 17 |
|
... | ... | |
42 | 44 |
private final ITermService termService; |
43 | 45 |
private final ICdmApplicationConfiguration app; |
44 | 46 |
|
47 |
public final static String REL_TYPE_KEY = "relTypeIun"; |
|
48 |
public final static String TO_TAXON_KEY = "toTaxonIun"; |
|
49 |
|
|
45 | 50 |
public EditConceptRelationshipPresenter() { |
46 | 51 |
taxonService = CdmSpringContextHelper.getTaxonService(); |
47 | 52 |
termService = CdmSpringContextHelper.getTermService(); |
... | ... | |
115 | 120 |
app.commitTransaction(tx); |
116 | 121 |
} |
117 | 122 |
|
123 |
|
|
124 |
|
|
125 |
public Map<String, IdUuidName> getRelTypeToTaxonIunMap(UUID fromTaxonUuid, UUID taxonRelUuid) { |
|
126 |
Map<String, IdUuidName> relTypeToTaxonIunMap = new HashMap<String, IdUuidName>(); |
|
127 |
TransactionStatus tx = app.startTransaction(); |
|
128 |
Taxon fromTaxon = CdmBase.deproxy(taxonService.load(fromTaxonUuid), Taxon.class); |
|
129 |
for(TaxonRelationship tr : fromTaxon.getRelationsFromThisTaxon()) { |
|
130 |
if(tr.getUuid().equals(taxonRelUuid)) { |
|
131 |
relTypeToTaxonIunMap.put(REL_TYPE_KEY, |
|
132 |
new IdUuidName(tr.getType().getId(),tr.getType().getUuid(), tr.getType().getTitleCache())); |
|
133 |
relTypeToTaxonIunMap.put(TO_TAXON_KEY, |
|
134 |
new IdUuidName(tr.getToTaxon().getId(), tr.getToTaxon().getUuid(), tr.getToTaxon().getName().getTitleCache())); |
|
135 |
} |
|
136 |
} |
|
137 |
app.commitTransaction(tx); |
|
138 |
return relTypeToTaxonIunMap; |
|
139 |
} |
|
140 |
|
|
118 | 141 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/CdmBaseUI.java | ||
---|---|---|
35 | 35 |
CdmVaadinSessionUtilities.initCdmDataChangeService(); |
36 | 36 |
|
37 | 37 |
CdmVaadinSessionUtilities.initSelectionService(); |
38 |
|
|
39 |
CdmVaadinSessionUtilities.initBasicEventService(); |
|
38 | 40 |
} |
39 | 41 |
|
40 | 42 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/CheckUI.java | ||
---|---|---|
20 | 20 |
// @WebServlet(value = "/*", asyncSupported = true, initParams = { |
21 | 21 |
// @WebInitParam(name="org.atmosphere.cpr.asyncSupport", value="org.atmosphere.container.Jetty9AsyncSupportWithWebSocket") |
22 | 22 |
// }) |
23 |
|
|
23 |
|
|
24 | 24 |
@WebServlet(value = {"/app/*", "/VAADIN/*"}, asyncSupported = true) |
25 |
@VaadinServletConfiguration(productionMode = false, ui = CheckUI.class, widgetset = "eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
|
25 |
@VaadinServletConfiguration(productionMode = true, ui = CheckUI.class, widgetset = "eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
|
26 | 26 |
public static class Servlet extends VaadinServlet { |
27 | 27 |
} |
28 | 28 |
|
... | ... | |
31 | 31 |
final VerticalLayout layout = new VerticalLayout(); |
32 | 32 |
layout.setMargin(true); |
33 | 33 |
setContent(layout); |
34 |
|
|
34 |
|
|
35 | 35 |
Button button = new Button("Click Me"); |
36 | 36 |
button.addClickListener(new Button.ClickListener() { |
37 |
@Override |
|
37 | 38 |
public void buttonClick(ClickEvent event) { |
38 | 39 |
layout.addComponent(new Label("Thank you for clicking")); |
39 | 40 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DbStatusUI.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
|
27 | 27 |
@WebServlet(value = {"/app/dbstatus/*"}, asyncSupported = true) |
28 |
@VaadinServletConfiguration(productionMode = false, ui = DbStatusUI.class, widgetset = "eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
|
28 |
@VaadinServletConfiguration(productionMode = true, ui = DbStatusUI.class, widgetset = "eu.etaxonomy.cdm.vaadin.AppWidgetSet")
|
|
29 | 29 |
public static class Servlet extends CdmVaadinConversationalServlet { |
30 | 30 |
} |
31 | 31 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmSpringContextHelper.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.cdm.vaadin.util; |
2 | 2 |
|
3 | 3 |
import java.sql.Connection; |
4 |
import java.sql.DatabaseMetaData; |
|
4 | 5 |
import java.sql.SQLException; |
5 | 6 |
|
6 | 7 |
import javax.servlet.ServletContext; |
... | ... | |
33 | 34 |
private final JDBCConnectionPool connPool; |
34 | 35 |
private static CdmSpringContextHelper contextHelper; |
35 | 36 |
|
37 |
private static DatabaseMetaData databaseMetaData; |
|
38 |
|
|
36 | 39 |
private CdmSpringContextHelper(ServletContext servletContext) throws SQLException { |
37 | 40 |
context = WebApplicationContextUtils. |
38 | 41 |
getRequiredWebApplicationContext(servletContext); |
... | ... | |
94 | 97 |
return getCurrent().getDataSource().getConnection(); |
95 | 98 |
} |
96 | 99 |
|
100 |
public static DatabaseMetaData getDatabaseMetaData() throws SQLException { |
|
101 |
if(databaseMetaData == null) { |
|
102 |
Connection conn = getConnection(); |
|
103 |
databaseMetaData = conn.getMetaData(); |
|
104 |
conn.close(); |
|
105 |
} |
|
106 |
return databaseMetaData; |
|
107 |
} |
|
108 |
|
|
97 | 109 |
public static ICdmApplicationConfiguration getApplicationConfiguration() { |
98 | 110 |
return (ICdmApplicationConfiguration) getCurrent().getBean("cdmApplicationDefaultConfiguration"); |
99 | 111 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinOperation.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.vaadin.util; |
11 | 11 |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Date; |
|
14 |
import java.util.List; |
|
15 |
|
|
12 | 16 |
import org.apache.log4j.Logger; |
13 | 17 |
|
14 | 18 |
import com.vaadin.ui.UI; |
... | ... | |
27 | 31 |
private int pollInterval = -1; |
28 | 32 |
private CdmProgressComponent progressComponent; |
29 | 33 |
|
34 |
private boolean opDone = false; |
|
35 |
|
|
36 |
List<CdmChangeEvent> events = new ArrayList<CdmChangeEvent>(); |
|
37 |
|
|
38 |
private Date now = new java.util.Date(); |
|
39 |
|
|
30 | 40 |
public CdmVaadinOperation(int pollInterval, CdmProgressComponent progressComponent) { |
31 | 41 |
this.pollInterval = pollInterval; |
32 | 42 |
this.progressComponent = progressComponent; |
43 |
|
|
44 |
UI.getCurrent().setPollInterval(pollInterval); |
|
45 |
|
|
46 |
// comment out below for debugging |
|
47 |
// logger.warn(new Timestamp(now.getTime()) + " : set polling interval to " + pollInterval); |
|
33 | 48 |
// UI.getCurrent().addPollListener(new UIEvents.PollListener() { |
34 | 49 |
// @Override |
35 | 50 |
// public void poll(UIEvents.PollEvent event) { |
36 |
// logger.warn("polling");
|
|
51 |
// logger.warn( new Timestamp(now.getTime()) + " : polling");
|
|
37 | 52 |
// } |
38 | 53 |
// }); |
39 | 54 |
} |
... | ... | |
42 | 57 |
|
43 | 58 |
} |
44 | 59 |
|
60 |
|
|
61 |
|
|
45 | 62 |
public void setProgress(final String progressText) { |
46 | 63 |
if(progressComponent == null) { |
47 | 64 |
return; |
... | ... | |
58 | 75 |
progressComponent.setProgress(progressText); |
59 | 76 |
} |
60 | 77 |
|
78 |
|
|
61 | 79 |
} |
62 | 80 |
|
63 | 81 |
public void setProgress(final String progressText, final float progress) { |
... | ... | |
98 | 116 |
@Override |
99 | 117 |
public void run() { |
100 | 118 |
|
101 |
UI.getCurrent().setPollInterval(pollInterval); |
|
102 |
//logger.warn("set polling interval to " + UI.getCurrent().getPollInterval()); |
|
103 |
|
|
104 |
|
|
105 | 119 |
final boolean success = execute(); |
106 |
//logger.warn("ran execute");
|
|
120 |
//logger.warn(new Timestamp(now.getTime()) + " : ran execute");
|
|
107 | 121 |
endProgress(); |
122 |
|
|
108 | 123 |
if(isAsync()) { |
109 | 124 |
UI.getCurrent().access(new Runnable() { |
110 | 125 |
@Override |
111 | 126 |
public void run() { |
112 | 127 |
try { |
128 |
if(success) { |
|
129 |
fireDelayedEvents(); |
|
130 |
} |
|
113 | 131 |
postOpUIUpdate(success); |
114 |
//logger.warn("ran postOpUIUpdate ");
|
|
132 |
//logger.warn(new Timestamp(now.getTime()) + " : ran postOpUIUpdate ");
|
|
115 | 133 |
} finally { |
116 | 134 |
UI.getCurrent().setPollInterval(-1); |
117 |
//logger.warn("set polling interval to " + UI.getCurrent().getPollInterval()); |
|
135 |
opDone = true; |
|
136 |
//logger.warn(new Timestamp(now.getTime()) + " : switched off pollling"); |
|
118 | 137 |
} |
119 | 138 |
} |
120 | 139 |
}); |
... | ... | |
128 | 147 |
|
129 | 148 |
public void postOpUIUpdate(boolean isOpSuccess) {} |
130 | 149 |
|
131 |
public void fireEvent(CdmChangeEvent event) { |
|
132 |
if(isAsync()) { |
|
133 |
CdmVaadinSessionUtilities.getCurrentCdmDataChangeService().fireChangeEvent(event, true); |
|
134 |
} else { |
|
135 |
CdmVaadinSessionUtilities.getCurrentCdmDataChangeService().fireChangeEvent(event, false); |
|
150 |
public void fireEvent(CdmChangeEvent event, boolean async) { |
|
151 |
CdmVaadinSessionUtilities.getCurrentCdmDataChangeService().fireChangeEvent(event, async); |
|
152 |
} |
|
153 |
|
|
154 |
public void registerDelayedEvent(CdmChangeEvent event) { |
|
155 |
events.add(event); |
|
156 |
} |
|
157 |
|
|
158 |
private void fireDelayedEvents() { |
|
159 |
for(CdmChangeEvent event : events) { |
|
160 |
fireEvent(event, false); |
|
136 | 161 |
} |
162 |
events.clear(); |
|
137 | 163 |
} |
138 | 164 |
|
139 | 165 |
public boolean isAsync() { |
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinSessionUtilities.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.vaadin.util; |
11 | 11 |
|
12 |
import org.apache.log4j.Logger; |
|
13 |
|
|
12 | 14 |
import com.vaadin.server.VaadinSession; |
13 | 15 |
|
16 |
import eu.etaxonomy.cdm.vaadin.session.BasicEventService; |
|
14 | 17 |
import eu.etaxonomy.cdm.vaadin.session.CdmDataChangeService; |
15 | 18 |
import eu.etaxonomy.cdm.vaadin.session.SelectionService; |
16 | 19 |
|
... | ... | |
21 | 24 |
*/ |
22 | 25 |
public class CdmVaadinSessionUtilities { |
23 | 26 |
|
27 |
private static final Logger logger = Logger.getLogger(CdmVaadinSessionUtilities.class); |
|
28 |
|
|
24 | 29 |
public static void setCurrentAttribute(String name, Object value) { |
25 | 30 |
try { |
26 | 31 |
VaadinSession.getCurrent().getLockInstance().lock(); |
... | ... | |
31 | 36 |
} |
32 | 37 |
|
33 | 38 |
public static void initCdmDataChangeService() { |
39 |
if(getCurrentCdmDataChangeService() != null) { |
|
40 |
logger.warn("replacing data change service with new one"); |
|
41 |
} |
|
34 | 42 |
setCurrentAttribute(CdmDataChangeService.KEY, new CdmDataChangeService()); |
35 | 43 |
} |
36 | 44 |
|
... | ... | |
39 | 47 |
} |
40 | 48 |
|
41 | 49 |
public static void initSelectionService() { |
50 |
if(getCurrentSelectionService() != null) { |
|
51 |
logger.warn("replacing selection service with new one"); |
|
52 |
} |
|
42 | 53 |
setCurrentAttribute(SelectionService.KEY, new SelectionService()); |
43 | 54 |
} |
44 | 55 |
|
45 | 56 |
public static SelectionService getCurrentSelectionService() { |
46 | 57 |
return (SelectionService) VaadinSession.getCurrent().getAttribute(SelectionService.KEY); |
47 | 58 |
} |
59 |
|
|
60 |
public static void initBasicEventService() { |
|
61 |
if(getCurrentBasicEventService() != null) { |
|
62 |
logger.warn("replacing basic event service with new one"); |
|
63 |
} |
|
64 |
setCurrentAttribute(BasicEventService.KEY, new BasicEventService()); |
|
65 |
} |
|
66 |
|
|
67 |
public static BasicEventService getCurrentBasicEventService() { |
|
68 |
return (BasicEventService) VaadinSession.getCurrent().getAttribute(BasicEventService.KEY); |
|
69 |
} |
|
48 | 70 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmVaadinUtilities.java | ||
---|---|---|
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
|
54 |
public static void setEnabled(Component root, boolean isEnabled, List<Component> exceptions) { |
|
54 |
public static void setEnabled(Component root, boolean isEnabled, List<? extends Component> exceptions) {
|
|
55 | 55 |
if(exceptions != null && exceptions.contains(root)) { |
56 | 56 |
return; |
57 | 57 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/ConceptRelationshipView.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.cdm.vaadin.view; |
11 | 11 |
|
12 |
import java.util.UUID; |
|
13 |
|
|
12 | 14 |
import com.vaadin.annotations.AutoGenerated; |
13 | 15 |
import com.vaadin.navigator.View; |
14 | 16 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
... | ... | |
18 | 20 |
|
19 | 21 |
import eu.etaxonomy.cdm.vaadin.component.ConceptRelationshipComposite; |
20 | 22 |
import eu.etaxonomy.cdm.vaadin.component.StatusComposite; |
23 |
import eu.etaxonomy.cdm.vaadin.session.BasicEvent; |
|
24 |
import eu.etaxonomy.cdm.vaadin.session.IBasicEventListener; |
|
25 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
21 | 26 |
|
22 | 27 |
/** |
23 | 28 |
* @author cmathew |
24 | 29 |
* @date 9 Apr 2015 |
25 | 30 |
* |
26 | 31 |
*/ |
27 |
public class ConceptRelationshipView extends CustomComponent implements View { |
|
32 |
public class ConceptRelationshipView extends CustomComponent implements View, IBasicEventListener {
|
|
28 | 33 |
|
29 | 34 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
30 | 35 |
|
... | ... | |
36 | 41 |
private ConceptRelationshipComposite conceptRelationshipComposite; |
37 | 42 |
@AutoGenerated |
38 | 43 |
private StatusComposite statusCompositeLeft; |
44 |
|
|
45 |
private StatusComposite primaryStatusComposite, secondaryStatusComposite; |
|
39 | 46 |
/** |
40 | 47 |
* The constructor should first build the main layout, set the |
41 | 48 |
* composition root and then do any custom initialization. |
... | ... | |
48 | 55 |
buildMainLayout(); |
49 | 56 |
setCompositionRoot(mainLayout); |
50 | 57 |
|
58 |
conceptRelationshipComposite.setView(this); |
|
51 | 59 |
conceptRelationshipComposite.setSizeFull(); |
60 |
|
|
61 |
setPrimaryStatusComposite(statusCompositeLeft.getSelectedClassificationUuid()); |
|
62 |
|
|
63 |
CdmVaadinSessionUtilities.getCurrentBasicEventService().register(this); |
|
52 | 64 |
} |
53 | 65 |
|
54 | 66 |
/* (non-Javadoc) |
... | ... | |
60 | 72 |
|
61 | 73 |
} |
62 | 74 |
|
75 |
public void setPrimaryStatusComposite(UUID scUuid) { |
|
76 |
if(scUuid != null) { |
|
77 |
if(statusCompositeLeft.getSelectedClassificationUuid().equals(scUuid)) { |
|
78 |
primaryStatusComposite = statusCompositeLeft; |
|
79 |
secondaryStatusComposite = statusCompositeRight; |
|
80 |
} else { |
|
81 |
secondaryStatusComposite = statusCompositeLeft; |
|
82 |
primaryStatusComposite = statusCompositeRight; |
|
83 |
} |
|
84 |
secondaryStatusComposite.clearTaxaTableSelections(); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/* (non-Javadoc) |
|
89 |
* @see eu.etaxonomy.cdm.vaadin.session.IBasicEventListener#onAction(eu.etaxonomy.cdm.vaadin.session.BasicEvent) |
|
90 |
*/ |
|
91 |
@Override |
|
92 |
public void onAction(BasicEvent event) { |
|
93 |
if(event.getEventId().equals(ConceptRelationshipComposite.UPDATE_START_ID)) { |
|
94 |
primaryStatusComposite.setTaxaTableEnabled(false); |
|
95 |
secondaryStatusComposite.setTaxaTableSelectable(false); |
|
96 |
} |
|
97 |
if(event.getEventId().equals(ConceptRelationshipComposite.UPDATE_END_ID)) { |
|
98 |
primaryStatusComposite.setTaxaTableEnabled(true); |
|
99 |
secondaryStatusComposite.setTaxaTableSelectable(true); |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
63 | 103 |
@AutoGenerated |
64 | 104 |
private HorizontalLayout buildMainLayout() { |
65 | 105 |
// common part: create layout |
... | ... | |
99 | 139 |
return mainLayout; |
100 | 140 |
} |
101 | 141 |
|
142 |
|
|
102 | 143 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IConceptRelationshipComponentListener.java | ||
---|---|---|
27 | 27 |
public void refreshRelationshipView(IdUuidName taxonUuid) throws JSONException; |
28 | 28 |
|
29 | 29 |
|
30 |
|
|
30 | 31 |
} |
src/main/resources/eu/etaxonomy/cdm/vaadin/jscomponent/lib/d3.conceptrelationshiptree_connector.js | ||
---|---|---|
22 | 22 |
.attr("height", height + margin.top + margin.bottom) |
23 | 23 |
.append("g") |
24 | 24 |
.attr("transform", "translate(" + margin.left + "," + margin.top + ")"); |
25 |
|
|
26 |
|
|
25 |
|
|
26 |
var selectedNode; |
|
27 | 27 |
this.onStateChange = function() { |
28 | 28 |
crTree = this.getState().conceptRelationshipTree; |
29 |
|
|
29 |
|
|
30 | 30 |
if(crTree) { |
31 | 31 |
root = JSON.parse(connector.getState().conceptRelationshipTree); |
32 |
|
|
32 |
|
|
33 | 33 |
root.x0 = height / 2; |
34 | 34 |
root.y0 = 0; |
35 | 35 |
|
... | ... | |
41 | 41 |
} |
42 | 42 |
} |
43 | 43 |
|
44 |
root.children.forEach(collapse); |
|
44 |
//root.children.forEach(collapse);
|
|
45 | 45 |
update(root); |
46 | 46 |
|
47 | 47 |
|
48 | 48 |
d3.select(self.frameElement).style("height", "800px"); |
49 | 49 |
} |
50 | 50 |
} |
51 |
|
|
51 |
|
|
52 | 52 |
function update(source) { |
53 | 53 |
|
54 | 54 |
// Compute the new tree layout. |
... | ... | |
70 | 70 |
.on("click", click); |
71 | 71 |
|
72 | 72 |
nodeEnter.append("circle") |
73 |
.attr("r", 5)
|
|
74 |
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
|
|
73 |
.attr("r", function(d) { return d.type === "taxon" ? 5 : 10; })
|
|
74 |
.style("fill", function(d) { return d === source && d.type === "conceptr" ? "#DF7401" : "#fff"; });
|
|
75 | 75 |
|
76 | 76 |
nodeEnter.append("text") |
77 |
.attr("x", function(d) { return d.children || d._children ? 5 : 10; }) |
|
78 |
.attr("y", "-15") |
|
77 |
.attr("x", function(d) { |
|
78 |
if(d.type === "conceptr") { |
|
79 |
return 50; |
|
80 |
} else { |
|
81 |
return d.children || d._children ? -10 : 10; |
|
82 |
} |
|
83 |
}) |
|
84 |
.attr("y", function(d) { return d.type === "conceptr" ? -20 : 0; }) |
|
79 | 85 |
.attr("dy", ".35em") |
80 | 86 |
.attr("text-anchor", function(d) { return d.children || d._children ? "end" : "start"; }) |
81 | 87 |
.text(function(d) { return d.name; }) |
... | ... | |
87 | 93 |
.attr("transform", function(d) { return "translate(" + d.y + "," + d.x + ")"; }); |
88 | 94 |
|
89 | 95 |
nodeUpdate.select("circle") |
90 |
.attr("r", 5)
|
|
91 |
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; });
|
|
96 |
.attr("r", function(d) { return d.type === "taxon" ? 5 : 10; })
|
|
97 |
.style("fill", function(d) { return d === selectedNode && d.type === "conceptr" ? "#DF7401" : "#fff"; });
|
|
92 | 98 |
|
93 | 99 |
nodeUpdate.select("text") |
94 | 100 |
.style("fill-opacity", 1); |
... | ... | |
136 | 142 |
d.x0 = d.x; |
137 | 143 |
d.y0 = d.y; |
138 | 144 |
}); |
139 |
|
|
145 |
|
|
140 | 146 |
} |
141 | 147 |
|
142 | 148 |
// Toggle children on click. |
143 | 149 |
function click(d) { |
144 | 150 |
//root.children.forEach(collapse); |
145 |
|
|
146 |
connector.test(d.uuid); |
|
147 |
if (d.children) { |
|
148 |
d._children = d.children; |
|
149 |
d.children = null; |
|
150 |
} else { |
|
151 |
d.children = d._children; |
|
152 |
d._children = null; |
|
151 |
|
|
152 |
if(d.type === "conceptr") { |
|
153 |
connector.select(d.uuid); |
|
153 | 154 |
} |
155 |
|
|
156 |
selectedNode = d; |
|
154 | 157 |
update(d); |
155 | 158 |
} |
156 | 159 |
} |
src/test/java/eu/etaxonomy/cdm/vaadin/presenter/ConceptRelationshipPresenterTest.java | ||
---|---|---|
15 | 15 |
import org.json.JSONException; |
16 | 16 |
import org.junit.Assert; |
17 | 17 |
import org.junit.BeforeClass; |
18 |
import org.junit.Ignore; |
|
19 | 18 |
import org.junit.Test; |
20 | 19 |
import org.unitils.dbunit.annotation.DataSet; |
21 | 20 |
|
... | ... | |
42 | 41 |
crp = new ConceptRelationshipPresenter(crTree); |
43 | 42 |
} |
44 | 43 |
|
45 |
@Ignore |
|
44 |
|
|
46 | 45 |
@Test |
47 | 46 |
public void testRefreshRelationshipView() throws JSONException { |
48 | 47 |
UUID taxonUuid = UUID.fromString("5f713f69-e03e-4a11-8a55-700fbbf44805"); |
Also available in: Unified diff
ConceptRelationshipComposite: added enabling / disabling of edit / delete buttons and firing event when edit concept relationship dialog is opened
EditConceptRelationshipComposite : fixed problems with async calls , adapted to updated operation class, added show in dialog method
NewTaxonBaseComposite : adapted to updated operation class
StatusComposite : added methods to update taxa table ui
D3ConceptRelationshipTree : added possibility to display one to one relationships
EditConceptRelationshipPresenter, EditConceptRelationshipPresenterTest : added method to get data to setup composite
CdmBaseUI, CdmVaadinSessionUtilities : using new basic events
CdmSpringContextHelper : fixed connection bug by closing connection after getting database metadata
CdmVaadinOperation : fixed problems with async calls
ConceptRelationshipView : setup ui changes for status composite depending on whether it is a primary of secondary composite
d3.conceptrelationshiptree_connector.js : added selected node capability