Revision 29078af6
Added by Andreas Kohlbecker about 7 years ago
src/main/java/eu/etaxonomy/cdm/mock/RegistrationService.java | ||
---|---|---|
27 | 27 |
import eu.etaxonomy.cdm.model.name.Rank; |
28 | 28 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
29 | 29 |
import eu.etaxonomy.cdm.vaadin.model.registration.RegistrationWorkingSet; |
30 |
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationDTO;
|
|
31 |
import eu.etaxonomy.cdm.vaadin.presenter.registration.RegistrationValidationException;
|
|
30 |
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationDTO;
|
|
31 |
import eu.etaxonomy.cdm.vaadin.view.registration.RegistrationValidationException;
|
|
32 | 32 |
|
33 | 33 |
/** |
34 | 34 |
* @author a.kohlbecker |
src/main/java/eu/etaxonomy/cdm/vaadin/component/ConceptRelationshipComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.component; |
|
10 |
|
|
11 |
import java.util.Arrays; |
|
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.Button.ClickEvent; |
|
20 |
import com.vaadin.ui.Button.ClickListener; |
|
21 |
import com.vaadin.ui.CustomComponent; |
|
22 |
import com.vaadin.ui.HorizontalLayout; |
|
23 |
import com.vaadin.ui.Notification; |
|
24 |
import com.vaadin.ui.Notification.Type; |
|
25 |
import com.vaadin.ui.VerticalLayout; |
|
26 |
|
|
27 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
|
28 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree; |
|
29 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree.Direction; |
|
30 |
import eu.etaxonomy.cdm.vaadin.presenter.ConceptRelationshipPresenter; |
|
31 |
import eu.etaxonomy.cdm.vaadin.session.BasicEvent; |
|
32 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
|
33 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action; |
|
34 |
import eu.etaxonomy.cdm.vaadin.session.IBasicEventListener; |
|
35 |
import eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener; |
|
36 |
import eu.etaxonomy.cdm.vaadin.session.ISelectionListener; |
|
37 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
|
38 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
39 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
|
40 |
import eu.etaxonomy.cdm.vaadin.view.ConceptRelationshipView; |
|
41 |
import eu.etaxonomy.cdm.vaadin.view.IConceptRelationshipComponentListener; |
|
42 |
|
|
43 |
/** |
|
44 |
* @author cmathew |
|
45 |
* @date 9 Apr 2015 |
|
46 |
* |
|
47 |
*/ |
|
48 |
public class ConceptRelationshipComposite extends CustomComponent implements ISelectionListener, ICdmChangeListener, IBasicEventListener { |
|
49 |
|
|
50 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
51 |
|
|
52 |
@AutoGenerated |
|
53 |
private VerticalLayout mainLayout; |
|
54 |
@AutoGenerated |
|
55 |
private D3ConceptRelationshipTree d3ConceptRelationShipTree; |
|
56 |
@AutoGenerated |
|
57 |
private HorizontalLayout updateHorizontalLayout; |
|
58 |
@AutoGenerated |
|
59 |
private Button deleteButton; |
|
60 |
@AutoGenerated |
|
61 |
private Button editButton; |
|
62 |
@AutoGenerated |
|
63 |
private Button newButton; |
|
64 |
private final IConceptRelationshipComponentListener listener; |
|
65 |
|
|
66 |
private IdUuidName fromTaxonIun; |
|
67 |
private UUID selectedTaxonRelUuid; |
|
68 |
|
|
69 |
private ConceptRelationshipView view; |
|
70 |
|
|
71 |
public static final String CREATE_NEW_CR_TITLE = "Create New Concept Relationship"; |
|
72 |
public static final String EDIT_CR_TITLE = "Edit Concept Relationship"; |
|
73 |
public static final String DELETE_CR_TITLE = "Delete Concept Relationship"; |
|
74 |
|
|
75 |
public static final String UPDATE_START_ID = "cr-update-start"; |
|
76 |
public static final String UPDATE_END_ID = "cr-update-end"; |
|
77 |
|
|
78 |
/** |
|
79 |
* The constructor should first build the main layout, set the |
|
80 |
* composition root and then do any custom initialization. |
|
81 |
* |
|
82 |
* The constructor will not be automatically regenerated by the |
|
83 |
* visual editor. |
|
84 |
*/ |
|
85 |
public ConceptRelationshipComposite() { |
|
86 |
buildMainLayout(); |
|
87 |
setCompositionRoot(mainLayout); |
|
88 |
|
|
89 |
CdmVaadinSessionUtilities.getCurrentSelectionService().register(this); |
|
90 |
CdmVaadinSessionUtilities.getCurrentCdmDataChangeService().register(this); |
|
91 |
CdmVaadinSessionUtilities.getCurrentBasicEventService().register(this); |
|
92 |
listener = new ConceptRelationshipPresenter(d3ConceptRelationShipTree); |
|
93 |
|
|
94 |
addUIListeners(); |
|
95 |
init(); |
|
96 |
} |
|
97 |
|
|
98 |
public void setView(ConceptRelationshipView view) { |
|
99 |
this.view = view; |
|
100 |
} |
|
101 |
|
|
102 |
private void init() { |
|
103 |
enableControls(false); |
|
104 |
initD3ConceptRelationShipTree(); |
|
105 |
} |
|
106 |
|
|
107 |
private void initD3ConceptRelationShipTree() { |
|
108 |
d3ConceptRelationShipTree.setImmediate(true); |
|
109 |
d3ConceptRelationShipTree.setConceptRelComposite(this); |
|
110 |
} |
|
111 |
|
|
112 |
private void addUIListeners() { |
|
113 |
addNewButtonListener(); |
|
114 |
addEditButtonListener(); |
|
115 |
addDeleteButtonListener(); |
|
116 |
} |
|
117 |
|
|
118 |
private void addNewButtonListener() { |
|
119 |
newButton.addClickListener(new ClickListener() { |
|
120 |
|
|
121 |
@Override |
|
122 |
public void buttonClick(ClickEvent event) { |
|
123 |
EditConceptRelationshipComposite.showInDialog(CREATE_NEW_CR_TITLE, |
|
124 |
fromTaxonIun, |
|
125 |
null, |
|
126 |
null, |
|
127 |
Action.Create, |
|
128 |
view.getDirection()); |
|
129 |
setSelectedTaxonRelUuid(null); |
|
130 |
} |
|
131 |
}); |
|
132 |
} |
|
133 |
|
|
134 |
private void addEditButtonListener() { |
|
135 |
editButton.addClickListener(new ClickListener() { |
|
136 |
|
|
137 |
@Override |
|
138 |
public void buttonClick(ClickEvent event) { |
|
139 |
EditConceptRelationshipComposite.showInDialog(EDIT_CR_TITLE, |
|
140 |
fromTaxonIun, |
|
141 |
selectedTaxonRelUuid, |
|
142 |
Action.Update, |
|
143 |
view.getDirection()); |
|
144 |
setSelectedTaxonRelUuid(null); |
|
145 |
} |
|
146 |
}); |
|
147 |
} |
|
148 |
|
|
149 |
private void addDeleteButtonListener() { |
|
150 |
deleteButton.addClickListener(new ClickListener() { |
|
151 |
|
|
152 |
@Override |
|
153 |
public void buttonClick(ClickEvent event) { |
|
154 |
EditConceptRelationshipComposite.showInDialog(DELETE_CR_TITLE, |
|
155 |
fromTaxonIun, |
|
156 |
selectedTaxonRelUuid, |
|
157 |
Action.Delete, |
|
158 |
view.getDirection()); |
|
159 |
setSelectedTaxonRelUuid(null); |
|
160 |
} |
|
161 |
}); |
|
162 |
} |
|
163 |
|
|
164 |
|
|
165 |
private void refreshRelationshipView(Direction direction) { |
|
166 |
if(fromTaxonIun != null) { |
|
167 |
try { |
|
168 |
listener.refreshRelationshipView(fromTaxonIun, direction); |
|
169 |
} catch (JSONException e) { |
|
170 |
Notification.show("Error generating concept relation JSON", e.getMessage(), Type.WARNING_MESSAGE); |
|
171 |
} |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 |
public void setSelectedTaxonRelUuid(UUID selectedTaxonRelUuid) { |
|
176 |
this.selectedTaxonRelUuid = selectedTaxonRelUuid; |
|
177 |
updateControls(); |
|
178 |
} |
|
179 |
|
|
180 |
private void enableControls(boolean enabled) { |
|
181 |
CdmVaadinUtilities.setEnabled(this, enabled, Arrays.asList(d3ConceptRelationShipTree)); |
|
182 |
} |
|
183 |
|
|
184 |
private void updateControls() { |
|
185 |
enableControls(false); |
|
186 |
if(fromTaxonIun != null) { |
|
187 |
newButton.setEnabled(true); |
|
188 |
} |
|
189 |
if(selectedTaxonRelUuid != null) { |
|
190 |
editButton.setEnabled(true); |
|
191 |
deleteButton.setEnabled(true); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
/* (non-Javadoc) |
|
196 |
* @see eu.etaxonomy.cdm.vaadin.session.ISelectionListener#onSelect(eu.etaxonomy.cdm.vaadin.session.SelectionEvent) |
|
197 |
*/ |
|
198 |
@Override |
|
199 |
public void onSelect(SelectionEvent event) { |
|
200 |
if(event.getSourceType().equals(StatusComposite.class)) { |
|
201 |
fromTaxonIun = (IdUuidName)event.getSelectedObjects().get(0); |
|
202 |
if(fromTaxonIun != null) { |
|
203 |
view.setPrimaryStatusCompositeUuid((StatusComposite)event.getSource()); |
|
204 |
refreshRelationshipView(view.getDirection()); |
|
205 |
setSelectedTaxonRelUuid(null); |
|
206 |
} else { |
|
207 |
listener.clearRelationshipView(); |
|
208 |
} |
|
209 |
updateControls(); |
|
210 |
|
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
/* (non-Javadoc) |
|
217 |
* @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onCreate(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent) |
|
218 |
*/ |
|
219 |
@Override |
|
220 |
public void onCreate(CdmChangeEvent event) { |
|
221 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
|
222 |
setSelectedTaxonRelUuid(null); |
|
223 |
refreshRelationshipView(view.getDirection()); |
|
224 |
|
|
225 |
} |
|
226 |
|
|
227 |
} |
|
228 |
|
|
229 |
|
|
230 |
/* (non-Javadoc) |
|
231 |
* @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onUpdate(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent) |
|
232 |
*/ |
|
233 |
@Override |
|
234 |
public void onUpdate(CdmChangeEvent event) { |
|
235 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
|
236 |
setSelectedTaxonRelUuid(null); |
|
237 |
refreshRelationshipView(view.getDirection()); |
|
238 |
} |
|
239 |
} |
|
240 |
|
|
241 |
|
|
242 |
/* (non-Javadoc) |
|
243 |
* @see eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener#onDelete(eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent) |
|
244 |
*/ |
|
245 |
@Override |
|
246 |
public void onDelete(CdmChangeEvent event) { |
|
247 |
if(event.getSourceType().equals(EditConceptRelationshipComposite.class)) { |
|
248 |
setSelectedTaxonRelUuid(null); |
|
249 |
refreshRelationshipView(view.getDirection()); |
|
250 |
} |
|
251 |
|
|
252 |
} |
|
253 |
|
|
254 |
|
|
255 |
/* (non-Javadoc) |
|
256 |
* @see eu.etaxonomy.cdm.vaadin.session.IBasicEventListener#onAction(eu.etaxonomy.cdm.vaadin.session.BasicEvent) |
|
257 |
*/ |
|
258 |
@Override |
|
259 |
public void onAction(BasicEvent event) { |
|
260 |
if(ConceptRelationshipComposite.UPDATE_START_ID.equals(event.getEventId())) { |
|
261 |
enableControls(false); |
|
262 |
} |
|
263 |
if(ConceptRelationshipComposite.UPDATE_END_ID.equals(event.getEventId())) { |
|
264 |
updateControls(); |
|
265 |
} |
|
266 |
|
|
267 |
} |
|
268 |
|
|
269 |
@AutoGenerated |
|
270 |
private VerticalLayout buildMainLayout() { |
|
271 |
// common part: create layout |
|
272 |
mainLayout = new VerticalLayout(); |
|
273 |
mainLayout.setImmediate(false); |
|
274 |
mainLayout.setWidth("100%"); |
|
275 |
mainLayout.setHeight("100%"); |
|
276 |
mainLayout.setMargin(true); |
|
277 |
mainLayout.setSpacing(true); |
|
278 |
|
|
279 |
// top-level component properties |
|
280 |
setWidth("100.0%"); |
|
281 |
setHeight("100.0%"); |
|
282 |
|
|
283 |
// updateHorizontalLayout |
|
284 |
updateHorizontalLayout = buildUpdateHorizontalLayout(); |
|
285 |
mainLayout.addComponent(updateHorizontalLayout); |
|
286 |
mainLayout.setComponentAlignment(updateHorizontalLayout, new Alignment(20)); |
|
287 |
|
|
288 |
// d3ConceptRelationShipTree |
|
289 |
d3ConceptRelationShipTree = new D3ConceptRelationshipTree(); |
|
290 |
d3ConceptRelationShipTree.setImmediate(false); |
|
291 |
d3ConceptRelationShipTree.setWidth("100.0%"); |
|
292 |
d3ConceptRelationShipTree.setHeight("-1px"); |
|
293 |
mainLayout.addComponent(d3ConceptRelationShipTree); |
|
294 |
mainLayout.setExpandRatio(d3ConceptRelationShipTree, 1.0f); |
|
295 |
mainLayout.setComponentAlignment(d3ConceptRelationShipTree, new Alignment(20)); |
|
296 |
|
|
297 |
return mainLayout; |
|
298 |
} |
|
299 |
|
|
300 |
@AutoGenerated |
|
301 |
private HorizontalLayout buildUpdateHorizontalLayout() { |
|
302 |
// common part: create layout |
|
303 |
updateHorizontalLayout = new HorizontalLayout(); |
|
304 |
updateHorizontalLayout.setImmediate(false); |
|
305 |
updateHorizontalLayout.setWidth("-1px"); |
|
306 |
updateHorizontalLayout.setHeight("-1px"); |
|
307 |
updateHorizontalLayout.setMargin(true); |
|
308 |
updateHorizontalLayout.setSpacing(true); |
|
309 |
|
|
310 |
// newButton |
|
311 |
newButton = new Button(); |
|
312 |
newButton.setCaption("new"); |
|
313 |
newButton.setImmediate(true); |
|
314 |
newButton.setWidth("-1px"); |
|
315 |
newButton.setHeight("-1px"); |
|
316 |
updateHorizontalLayout.addComponent(newButton); |
|
317 |
|
|
318 |
// editButton |
|
319 |
editButton = new Button(); |
|
320 |
editButton.setCaption("edit"); |
|
321 |
editButton.setImmediate(true); |
|
322 |
editButton.setWidth("-1px"); |
|
323 |
editButton.setHeight("-1px"); |
|
324 |
updateHorizontalLayout.addComponent(editButton); |
|
325 |
|
|
326 |
// deleteButton |
|
327 |
deleteButton = new Button(); |
|
328 |
deleteButton.setCaption("delete"); |
|
329 |
deleteButton.setImmediate(true); |
|
330 |
deleteButton.setWidth("-1px"); |
|
331 |
deleteButton.setHeight("-1px"); |
|
332 |
updateHorizontalLayout.addComponent(deleteButton); |
|
333 |
|
|
334 |
return updateHorizontalLayout; |
|
335 |
} |
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/component/EditConceptRelationshipComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.component; |
|
10 |
|
|
11 |
import java.sql.SQLException; |
|
12 |
import java.util.Arrays; |
|
13 |
import java.util.Map; |
|
14 |
import java.util.UUID; |
|
15 |
|
|
16 |
import com.vaadin.annotations.AutoGenerated; |
|
17 |
import com.vaadin.data.Container.Hierarchical; |
|
18 |
import com.vaadin.data.Validator.EmptyValueException; |
|
19 |
import com.vaadin.data.util.sqlcontainer.RowId; |
|
20 |
import com.vaadin.event.Transferable; |
|
21 |
import com.vaadin.event.dd.DragAndDropEvent; |
|
22 |
import com.vaadin.event.dd.DropHandler; |
|
23 |
import com.vaadin.event.dd.acceptcriteria.AcceptAll; |
|
24 |
import com.vaadin.event.dd.acceptcriteria.AcceptCriterion; |
|
25 |
import com.vaadin.server.FontAwesome; |
|
26 |
import com.vaadin.server.Page; |
|
27 |
import com.vaadin.shared.ui.label.ContentMode; |
|
28 |
import com.vaadin.ui.Alignment; |
|
29 |
import com.vaadin.ui.Button; |
|
30 |
import com.vaadin.ui.Button.ClickEvent; |
|
31 |
import com.vaadin.ui.Button.ClickListener; |
|
32 |
import com.vaadin.ui.ComboBox; |
|
33 |
import com.vaadin.ui.Component; |
|
34 |
import com.vaadin.ui.CustomComponent; |
|
35 |
import com.vaadin.ui.DragAndDropWrapper; |
|
36 |
import com.vaadin.ui.HorizontalLayout; |
|
37 |
import com.vaadin.ui.Label; |
|
38 |
import com.vaadin.ui.Notification; |
|
39 |
import com.vaadin.ui.Notification.Type; |
|
40 |
import com.vaadin.ui.TextField; |
|
41 |
import com.vaadin.ui.TreeTable; |
|
42 |
import com.vaadin.ui.UI; |
|
43 |
import com.vaadin.ui.VerticalLayout; |
|
44 |
import com.vaadin.ui.Window; |
|
45 |
|
|
46 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
|
47 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
|
48 |
import eu.etaxonomy.cdm.vaadin.jscomponent.D3ConceptRelationshipTree.Direction; |
|
49 |
import eu.etaxonomy.cdm.vaadin.presenter.EditConceptRelationshipPresenter; |
|
50 |
import eu.etaxonomy.cdm.vaadin.session.BasicEvent; |
|
51 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
|
52 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action; |
|
53 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation; |
|
54 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
55 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
|
56 |
; |
|
57 |
|
|
58 |
/** |
|
59 |
* @author cmathew |
|
60 |
* @date 13 Apr 2015 |
|
61 |
* |
|
62 |
*/ |
|
63 |
public class EditConceptRelationshipComposite extends CustomComponent { |
|
64 |
|
|
65 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
66 |
|
|
67 |
@AutoGenerated |
|
68 |
private VerticalLayout mainLayout; |
|
69 |
@AutoGenerated |
|
70 |
private CdmProgressComponent cdmProgressComponent; |
|
71 |
@AutoGenerated |
|
72 |
private HorizontalLayout saveCancelHLayout; |
|
73 |
@AutoGenerated |
|
74 |
private Button cancelButton; |
|
75 |
@AutoGenerated |
|
76 |
private Button saveButton; |
|
77 |
@AutoGenerated |
|
78 |
private HorizontalLayout horizontalLayout; |
|
79 |
@AutoGenerated |
|
80 |
private Label rightLabel; |
|
81 |
@AutoGenerated |
|
82 |
private VerticalLayout typeVLayout; |
|
83 |
@AutoGenerated |
|
84 |
private ComboBox conceptRComboBox; |
|
85 |
@AutoGenerated |
|
86 |
private Label typeLabel; |
|
87 |
@AutoGenerated |
|
88 |
private Label leftLabel; |
|
89 |
private TextField leftTaxonTextField, rightTaxonTextField; |
|
90 |
|
|
91 |
private Component leftTaxonComponent, rightTaxonComponent; |
|
92 |
private TextField fromTaxonTextField, toTaxonTextField; |
|
93 |
private Label leftTaxonLabel, rightTaxonLabel; |
|
94 |
|
|
95 |
|
|
96 |
private final EditConceptRelationshipPresenter presenter; |
|
97 |
|
|
98 |
private IdUuidName fromTaxonIun, taxonRTypeIun, toTaxonIun; |
|
99 |
private UUID relUuid; |
|
100 |
private Window window; |
|
101 |
|
|
102 |
private final static String CHOOSE_TREL_TYPE = "Choose Type ..."; |
|
103 |
private final static String DRAG_TAXON_HINT = "Drag Taxon here ..."; |
|
104 |
|
|
105 |
|
|
106 |
private Action action; |
|
107 |
private Direction direction; |
|
108 |
|
|
109 |
public EditConceptRelationshipComposite(IdUuidName fromTaxonIdUuidName, |
|
110 |
IdUuidName taxonRTypeIdUuidName, |
|
111 |
IdUuidName toTaxonIdUuidName, |
|
112 |
Action action, |
|
113 |
Direction direction) { |
|
114 |
this(direction); |
|
115 |
|
|
116 |
init(fromTaxonIdUuidName, taxonRTypeIdUuidName, toTaxonIdUuidName, action); |
|
117 |
|
|
118 |
} |
|
119 |
|
|
120 |
public EditConceptRelationshipComposite(IdUuidName fromTaxonIun, |
|
121 |
UUID relUuid, |
|
122 |
Action action, |
|
123 |
Direction direction) { |
|
124 |
this(direction); |
|
125 |
this.relUuid = relUuid; |
|
126 |
|
|
127 |
Map<String, IdUuidName> map = presenter.getRelTypeToTaxonIunMap(fromTaxonIun.getUuid(), relUuid); |
|
128 |
taxonRTypeIun = map.get(EditConceptRelationshipPresenter.REL_TYPE_KEY); |
|
129 |
toTaxonIun = map.get(EditConceptRelationshipPresenter.TO_TAXON_KEY); |
|
130 |
init(fromTaxonIun, taxonRTypeIun, toTaxonIun, action); |
|
131 |
|
|
132 |
} |
|
133 |
|
|
134 |
|
|
135 |
/** |
|
136 |
* The constructor should first build the main layout, set the |
|
137 |
* composition root and then do any custom initialization. |
|
138 |
* |
|
139 |
* The constructor will not be automatically regenerated by the |
|
140 |
* visual editor. |
|
141 |
*/ |
|
142 |
private EditConceptRelationshipComposite(Direction direction) { |
|
143 |
this.direction = direction; |
|
144 |
|
|
145 |
buildMainLayout(); |
|
146 |
initDirectionComponents(); |
|
147 |
setCompositionRoot(mainLayout); |
|
148 |
|
|
149 |
this.presenter = new EditConceptRelationshipPresenter(); |
|
150 |
addUIListeners(); |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
public void init(IdUuidName fromTaxonIdUuidName, |
|
155 |
IdUuidName taxonRTypeIdUuidName, |
|
156 |
IdUuidName toTaxonIdUuidName, |
|
157 |
Action action) { |
|
158 |
|
|
159 |
this.fromTaxonIun = fromTaxonIdUuidName; |
|
160 |
this.taxonRTypeIun = taxonRTypeIdUuidName; |
|
161 |
this.toTaxonIun = toTaxonIdUuidName; |
|
162 |
this.action = action; |
|
163 |
|
|
164 |
initFromTaxon(); |
|
165 |
initConceptRComboBox(); |
|
166 |
} |
|
167 |
|
|
168 |
public void setWindow(Window window) { |
|
169 |
this.window = window; |
|
170 |
} |
|
171 |
|
|
172 |
public boolean canCreateRelationship() { |
|
173 |
return presenter.canCreateRelationship(fromTaxonIun.getUuid()); |
|
174 |
} |
|
175 |
|
|
176 |
private void initFromTaxon() { |
|
177 |
if(fromTaxonIun != null) { |
|
178 |
fromTaxonTextField.setReadOnly(false); |
|
179 |
fromTaxonTextField.setValue(fromTaxonIun.getName()); |
|
180 |
fromTaxonTextField.setReadOnly(true); |
|
181 |
} |
|
182 |
if(toTaxonIun != null) { |
|
183 |
toTaxonTextField.setReadOnly(false); |
|
184 |
toTaxonTextField.setValue(toTaxonIun.getName()); |
|
185 |
toTaxonTextField.setReadOnly(true); |
|
186 |
} |
|
187 |
} |
|
188 |
|
|
189 |
private void initDirectionComponents() { |
|
190 |
|
|
191 |
initTaxonComponents(); |
|
192 |
|
|
193 |
leftLabel.addStyleName("cr-arrow"); |
|
194 |
leftLabel.setContentMode(ContentMode.HTML); |
|
195 |
|
|
196 |
rightLabel.addStyleName("cr-arrow"); |
|
197 |
rightLabel.setContentMode(ContentMode.HTML); |
|
198 |
|
|
199 |
rightTaxonTextField.setReadOnly(false); |
|
200 |
leftTaxonTextField.setReadOnly(false); |
|
201 |
switch(direction) { |
|
202 |
case LEFT_RIGHT: |
|
203 |
leftLabel.setValue(FontAwesome.CARET_RIGHT.getHtml()); |
|
204 |
rightLabel.setValue(FontAwesome.CARET_RIGHT.getHtml()); |
|
205 |
leftTaxonLabel.setValue("From Taxon"); |
|
206 |
rightTaxonLabel.setValue("To Taxon"); |
|
207 |
fromTaxonTextField = leftTaxonTextField; |
|
208 |
toTaxonTextField = rightTaxonTextField; |
|
209 |
rightTaxonTextField.setValue(DRAG_TAXON_HINT); |
|
210 |
rightTaxonComponent = intiDragDropWrapper(rightTaxonComponent, rightTaxonTextField); |
|
211 |
break; |
|
212 |
case RIGHT_LEFT: |
|
213 |
leftLabel.setValue(FontAwesome.CARET_LEFT.getHtml()); |
|
214 |
rightLabel.setValue(FontAwesome.CARET_LEFT.getHtml()); |
|
215 |
leftTaxonLabel.setValue("To Taxon"); |
|
216 |
rightTaxonLabel.setValue("From Taxon"); |
|
217 |
leftTaxonTextField.setValue(DRAG_TAXON_HINT); |
|
218 |
fromTaxonTextField = rightTaxonTextField; |
|
219 |
toTaxonTextField = leftTaxonTextField; |
|
220 |
leftTaxonComponent = intiDragDropWrapper(leftTaxonComponent, leftTaxonTextField); |
|
221 |
break; |
|
222 |
} |
|
223 |
|
|
224 |
rightTaxonTextField.setReadOnly(true); |
|
225 |
leftTaxonTextField.setReadOnly(true); |
|
226 |
|
|
227 |
horizontalLayout.addComponent(leftTaxonComponent,0); |
|
228 |
horizontalLayout.setComponentAlignment(leftTaxonComponent, new Alignment(48)); |
|
229 |
|
|
230 |
|
|
231 |
horizontalLayout.addComponent(rightTaxonComponent); |
|
232 |
horizontalLayout.setComponentAlignment(rightTaxonComponent, new Alignment(48)); |
|
233 |
|
|
234 |
leftLabel.setSizeUndefined(); |
|
235 |
rightLabel.setSizeUndefined(); |
|
236 |
|
|
237 |
} |
|
238 |
|
|
239 |
private void initConceptRComboBox() { |
|
240 |
conceptRComboBox.setImmediate(true); |
|
241 |
conceptRComboBox.setItemCaptionPropertyId("titleCache"); |
|
242 |
try { |
|
243 |
conceptRComboBox.setContainerDataSource(presenter.loadTaxonRelationshipTypeContainer()); |
|
244 |
} catch (SQLException e) { |
|
245 |
// TODO Auto-generated catch block |
|
246 |
e.printStackTrace(); |
|
247 |
} |
|
248 |
if(taxonRTypeIun == null) { |
|
249 |
conceptRComboBox.setInputPrompt(CHOOSE_TREL_TYPE); |
|
250 |
} else { |
|
251 |
conceptRComboBox.setValue(new RowId(taxonRTypeIun.getId())); |
|
252 |
} |
|
253 |
|
|
254 |
if(action == Action.Delete) { |
|
255 |
conceptRComboBox.setReadOnly(true); |
|
256 |
saveButton.setCaption("ok"); |
|
257 |
} |
|
258 |
} |
|
259 |
|
|
260 |
private void initTaxonComponents() { |
|
261 |
// init left taxon layout |
|
262 |
leftTaxonLabel = new Label(); |
|
263 |
leftTaxonTextField = new TextField(); |
|
264 |
leftTaxonComponent = buildTaxonVLayout(leftTaxonLabel, leftTaxonTextField); |
|
265 |
|
|
266 |
// init right taxon layout |
|
267 |
rightTaxonLabel = new Label(); |
|
268 |
rightTaxonTextField = new TextField(); |
|
269 |
rightTaxonComponent = buildTaxonVLayout(rightTaxonLabel, rightTaxonTextField); |
|
270 |
} |
|
271 |
|
|
272 |
private DragAndDropWrapper intiDragDropWrapper(Component toTaxonLayout, final TextField toTaxonTextField) { |
|
273 |
|
|
274 |
DragAndDropWrapper toTaxonLayoutWrapper = new DragAndDropWrapper(toTaxonLayout); |
|
275 |
toTaxonLayoutWrapper.setImmediate(false); |
|
276 |
toTaxonLayoutWrapper.setWidth("-1px"); |
|
277 |
toTaxonLayoutWrapper.setHeight("-1px"); |
|
278 |
|
|
279 |
toTaxonLayoutWrapper.setDropHandler(new DropHandler() { |
|
280 |
|
|
281 |
@Override |
|
282 |
public AcceptCriterion getAcceptCriterion() { |
|
283 |
return AcceptAll.get(); |
|
284 |
} |
|
285 |
|
|
286 |
@Override |
|
287 |
public void drop(DragAndDropEvent event) { |
|
288 |
// Wrapper for the object that is dragged |
|
289 |
Transferable t = event.getTransferable(); |
|
290 |
|
|
291 |
// Make sure the drag source is a status composite tree table |
|
292 |
if (action != Action.Delete && t.getSourceComponent() instanceof TreeTable) { |
|
293 |
TreeTable table = (TreeTable)t.getSourceComponent(); |
|
294 |
Hierarchical containerDataSource = table.getContainerDataSource(); |
|
295 |
if(containerDataSource instanceof LeafNodeTaxonContainer) { |
|
296 |
LeafNodeTaxonContainer lntc = (LeafNodeTaxonContainer)containerDataSource; |
|
297 |
Object sourceItemId = t.getData("itemId"); |
|
298 |
String toName = (String)lntc.getProperty(sourceItemId, LeafNodeTaxonContainer.NAME_ID).getValue(); |
|
299 |
toTaxonIun = new IdUuidName(sourceItemId, |
|
300 |
lntc.getUuid(sourceItemId), |
|
301 |
toName); |
|
302 |
toTaxonTextField.setReadOnly(false); |
|
303 |
toTaxonTextField.setValue(toName); |
|
304 |
toTaxonTextField.setReadOnly(true); |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
308 |
}); |
|
309 |
return toTaxonLayoutWrapper; |
|
310 |
|
|
311 |
} |
|
312 |
|
|
313 |
|
|
314 |
private void addUIListeners() { |
|
315 |
addSaveButtonListener(); |
|
316 |
addCancelButtonListener(); |
|
317 |
|
|
318 |
} |
|
319 |
|
|
320 |
private void addSaveButtonListener() { |
|
321 |
saveButton.addClickListener(new ClickListener() { |
|
322 |
|
|
323 |
@Override |
|
324 |
public void buttonClick(ClickEvent event) { |
|
325 |
|
|
326 |
|
|
327 |
try { |
|
328 |
conceptRComboBox.validate(); |
|
329 |
rightTaxonTextField.validate(); |
|
330 |
if(toTaxonIun == null) { |
|
331 |
// FIXME: Not efficient - figure out a way |
|
332 |
// of validation including the null check |
|
333 |
throw new EmptyValueException(""); |
|
334 |
} |
|
335 |
} catch (EmptyValueException e) { |
|
336 |
Notification notification = new Notification("Invalid input", "Neither Relationship Type nor To Taxon can be empty", Type.WARNING_MESSAGE); |
|
337 |
notification.setDelayMsec(2000); |
|
338 |
notification.show(Page.getCurrent()); |
|
339 |
return; |
|
340 |
} |
|
341 |
|
|
342 |
CdmVaadinUtilities.setEnabled(mainLayout, false, null); |
|
343 |
|
|
344 |
try { |
|
345 |
CdmVaadinUtilities.exec(new CdmVaadinOperation(1000, cdmProgressComponent) { |
|
346 |
@Override |
|
347 |
public boolean execute() { |
|
348 |
UUID relTypeUuid = presenter.getTaxonRTypeContainer().getUuid(conceptRComboBox.getValue()); |
|
349 |
switch(action) { |
|
350 |
case Create: |
|
351 |
setProgress("Saving New Concept Relationship"); |
|
352 |
presenter.createRelationship(fromTaxonIun.getUuid(), relTypeUuid, toTaxonIun.getUuid()); |
|
353 |
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
354 |
break; |
|
355 |
case Update: |
|
356 |
setProgress("Update Concept Relationship"); |
|
357 |
presenter.updateRelationship(fromTaxonIun.getUuid(), relUuid, relTypeUuid, toTaxonIun.getUuid()); |
|
358 |
registerDelayedEvent(new CdmChangeEvent(Action.Update, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
359 |
break; |
|
360 |
case Delete: |
|
361 |
setProgress("Deleting Concept Relationship"); |
|
362 |
presenter.deleteRelationship(fromTaxonIun.getUuid(), relUuid); |
|
363 |
registerDelayedEvent(new CdmChangeEvent(Action.Delete, Arrays.asList((Object)relTypeUuid), EditConceptRelationshipComposite.class)); |
|
364 |
break; |
|
365 |
default: |
|
366 |
|
|
367 |
} |
|
368 |
return true; |
|
369 |
} |
|
370 |
|
|
371 |
@Override |
|
372 |
public void postOpUIUpdate(boolean success) { |
|
373 |
if(success) { |
|
374 |
if(window != null) { |
|
375 |
UI.getCurrent().removeWindow(window); |
|
376 |
} |
|
377 |
} else { |
|
378 |
CdmVaadinUtilities.setEnabled(mainLayout, true, null); |
|
379 |
} |
|
380 |
} |
|
381 |
}); |
|
382 |
} finally { |
|
383 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
384 |
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), false); |
|
385 |
} |
|
386 |
} |
|
387 |
}); |
|
388 |
} |
|
389 |
|
|
390 |
private void addCancelButtonListener() { |
|
391 |
cancelButton.addClickListener(new ClickListener() { |
|
392 |
|
|
393 |
@Override |
|
394 |
public void buttonClick(ClickEvent event) { |
|
395 |
if(window != null) { |
|
396 |
UI.getCurrent().removeWindow(window); |
|
397 |
} |
|
398 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
399 |
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_END_ID, EditConceptRelationshipComposite.class), true); |
|
400 |
} |
|
401 |
}); |
|
402 |
} |
|
403 |
|
|
404 |
|
|
405 |
private static void showInDialog(String windowTitle, |
|
406 |
EditConceptRelationshipComposite ecrc) { |
|
407 |
//FIXME : hack for the moment to demonstrate checking of concept relationship rules |
|
408 |
if(ecrc.action.equals(Action.Create) && !ecrc.canCreateRelationship()) { |
|
409 |
Notification.show("Cannot create relationship for a taxon which is already congruent to another taxon", Type.WARNING_MESSAGE); |
|
410 |
return; |
|
411 |
} |
|
412 |
Window dialog = new Window(windowTitle); |
|
413 |
dialog.setModal(false); |
|
414 |
dialog.setClosable(false); |
|
415 |
dialog.setResizable(false); |
|
416 |
UI.getCurrent().addWindow(dialog); |
|
417 |
ecrc.setWindow(dialog); |
|
418 |
dialog.setContent(ecrc); |
|
419 |
CdmVaadinSessionUtilities.getCurrentBasicEventService() |
|
420 |
.fireBasicEvent(new BasicEvent(ConceptRelationshipComposite.UPDATE_START_ID, ConceptRelationshipComposite.class), false); |
|
421 |
} |
|
422 |
|
|
423 |
public static void showInDialog(String windowTitle, |
|
424 |
IdUuidName fromTaxonIun, |
|
425 |
IdUuidName taxonRTypeIun, |
|
426 |
IdUuidName toTaxonIun, |
|
427 |
Action action, |
|
428 |
Direction direction) { |
|
429 |
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, taxonRTypeIun, toTaxonIun,action, direction); |
|
430 |
showInDialog(windowTitle, ecrc); |
|
431 |
} |
|
432 |
|
|
433 |
public static void showInDialog(String windowTitle, |
|
434 |
IdUuidName fromTaxonIun, |
|
435 |
UUID relUuid, |
|
436 |
Action action, |
|
437 |
Direction direction) { |
|
438 |
EditConceptRelationshipComposite ecrc = new EditConceptRelationshipComposite(fromTaxonIun, relUuid, action, direction); |
|
439 |
showInDialog(windowTitle, ecrc); |
|
440 |
} |
|
441 |
|
|
442 |
|
|
443 |
private VerticalLayout buildTaxonVLayout(Label taxonDirLabel, TextField taxonTextField) { |
|
444 |
// common part: create layout |
|
445 |
VerticalLayout vLayout = new VerticalLayout(); |
|
446 |
vLayout.setImmediate(false); |
|
447 |
vLayout.setWidth("-1px"); |
|
448 |
vLayout.setHeight("-1px"); |
|
449 |
vLayout.setMargin(false); |
|
450 |
vLayout.setSpacing(true); |
|
451 |
|
|
452 |
|
|
453 |
taxonDirLabel.setImmediate(false); |
|
454 |
taxonDirLabel.setWidth("-1px"); |
|
455 |
taxonDirLabel.setHeight("-1px"); |
|
456 |
|
|
457 |
vLayout.addComponent(taxonDirLabel); |
|
458 |
vLayout.setComponentAlignment(taxonDirLabel, new Alignment(48)); |
|
459 |
|
|
460 |
|
|
461 |
taxonTextField.setImmediate(false); |
|
462 |
taxonTextField.setWidth("-1px"); |
|
463 |
taxonTextField.setHeight("-1px"); |
|
464 |
taxonTextField.setInvalidAllowed(false); |
|
465 |
taxonTextField.setRequired(true); |
|
466 |
taxonTextField.setReadOnly(true); |
|
467 |
vLayout.addComponent(taxonTextField); |
|
468 |
vLayout.setComponentAlignment(taxonTextField, new Alignment(48)); |
|
469 |
|
|
470 |
return vLayout; |
|
471 |
} |
|
472 |
|
|
473 |
@AutoGenerated |
|
474 |
private VerticalLayout buildMainLayout() { |
|
475 |
// common part: create layout |
|
476 |
mainLayout = new VerticalLayout(); |
|
477 |
mainLayout.setImmediate(false); |
|
478 |
mainLayout.setWidth("740px"); |
|
479 |
mainLayout.setHeight("170px"); |
|
480 |
mainLayout.setMargin(false); |
|
481 |
mainLayout.setSpacing(true); |
|
482 |
|
|
483 |
// top-level component properties |
|
484 |
setWidth("740px"); |
|
485 |
setHeight("170px"); |
|
486 |
|
|
487 |
// horizontalLayout |
|
488 |
horizontalLayout = buildHorizontalLayout(); |
|
489 |
mainLayout.addComponent(horizontalLayout); |
|
490 |
mainLayout.setExpandRatio(horizontalLayout, 1.0f); |
|
491 |
mainLayout.setComponentAlignment(horizontalLayout, new Alignment(48)); |
|
492 |
|
|
493 |
// saveCancelHLayout |
|
494 |
saveCancelHLayout = buildSaveCancelHLayout(); |
|
495 |
mainLayout.addComponent(saveCancelHLayout); |
|
496 |
mainLayout.setComponentAlignment(saveCancelHLayout, new Alignment(48)); |
|
497 |
|
|
498 |
// cdmProgressComponent |
|
499 |
cdmProgressComponent = new CdmProgressComponent(); |
|
500 |
cdmProgressComponent.setImmediate(false); |
|
501 |
cdmProgressComponent.setWidth("-1px"); |
|
502 |
cdmProgressComponent.setHeight("-1px"); |
|
503 |
mainLayout.addComponent(cdmProgressComponent); |
|
504 |
mainLayout.setComponentAlignment(cdmProgressComponent, new Alignment(48)); |
|
505 |
|
|
506 |
return mainLayout; |
|
507 |
} |
|
508 |
|
|
509 |
@AutoGenerated |
|
510 |
private HorizontalLayout buildHorizontalLayout() { |
|
511 |
// common part: create layout |
|
512 |
horizontalLayout = new HorizontalLayout(); |
|
513 |
horizontalLayout.setImmediate(false); |
|
514 |
horizontalLayout.setWidth("-1px"); |
|
515 |
horizontalLayout.setHeight("-1px"); |
|
516 |
horizontalLayout.setMargin(true); |
|
517 |
horizontalLayout.setSpacing(true); |
|
518 |
|
|
519 |
// leftLabel |
|
520 |
leftLabel = new Label(); |
|
521 |
leftLabel.setImmediate(false); |
|
522 |
leftLabel.setWidth("-1px"); |
|
523 |
leftLabel.setHeight("30px"); |
|
524 |
leftLabel.setValue("Label"); |
|
525 |
horizontalLayout.addComponent(leftLabel); |
|
526 |
horizontalLayout.setComponentAlignment(leftLabel, new Alignment(24)); |
|
527 |
|
|
528 |
// typeVLayout |
|
529 |
typeVLayout = buildTypeVLayout(); |
|
530 |
horizontalLayout.addComponent(typeVLayout); |
|
531 |
horizontalLayout.setExpandRatio(typeVLayout, 1.0f); |
|
532 |
horizontalLayout.setComponentAlignment(typeVLayout, new Alignment(48)); |
|
533 |
|
|
534 |
// rightLabel |
|
535 |
rightLabel = new Label(); |
|
536 |
rightLabel.setImmediate(false); |
|
537 |
rightLabel.setWidth("-1px"); |
|
538 |
rightLabel.setHeight("30px"); |
|
539 |
rightLabel.setValue("Label"); |
|
540 |
horizontalLayout.addComponent(rightLabel); |
|
541 |
horizontalLayout.setComponentAlignment(rightLabel, new Alignment(24)); |
|
542 |
|
|
543 |
return horizontalLayout; |
|
544 |
} |
|
545 |
|
|
546 |
@AutoGenerated |
|
547 |
private VerticalLayout buildTypeVLayout() { |
|
548 |
// common part: create layout |
|
549 |
typeVLayout = new VerticalLayout(); |
|
550 |
typeVLayout.setImmediate(false); |
|
551 |
typeVLayout.setWidth("-1px"); |
|
552 |
typeVLayout.setHeight("-1px"); |
|
553 |
typeVLayout.setMargin(false); |
|
554 |
typeVLayout.setSpacing(true); |
|
555 |
|
|
556 |
// typeLabel |
|
557 |
typeLabel = new Label(); |
|
558 |
typeLabel.setImmediate(false); |
|
559 |
typeLabel.setWidth("-1px"); |
|
560 |
typeLabel.setHeight("-1px"); |
|
561 |
typeLabel.setValue("Type"); |
|
562 |
typeVLayout.addComponent(typeLabel); |
|
563 |
typeVLayout.setComponentAlignment(typeLabel, new Alignment(48)); |
|
564 |
|
|
565 |
// conceptRComboBox |
|
566 |
conceptRComboBox = new ComboBox(); |
|
567 |
conceptRComboBox.setImmediate(false); |
|
568 |
conceptRComboBox.setWidth("260px"); |
|
569 |
conceptRComboBox.setHeight("-1px"); |
|
570 |
conceptRComboBox.setRequired(true); |
|
571 |
typeVLayout.addComponent(conceptRComboBox); |
|
572 |
typeVLayout.setExpandRatio(conceptRComboBox, 1.0f); |
|
573 |
typeVLayout.setComponentAlignment(conceptRComboBox, new Alignment(48)); |
|
574 |
|
|
575 |
return typeVLayout; |
|
576 |
} |
|
577 |
|
|
578 |
@AutoGenerated |
|
579 |
private HorizontalLayout buildSaveCancelHLayout() { |
|
580 |
// common part: create layout |
|
581 |
saveCancelHLayout = new HorizontalLayout(); |
|
582 |
saveCancelHLayout.setImmediate(false); |
|
583 |
saveCancelHLayout.setWidth("-1px"); |
|
584 |
saveCancelHLayout.setHeight("-1px"); |
|
585 |
saveCancelHLayout.setMargin(false); |
|
586 |
saveCancelHLayout.setSpacing(true); |
|
587 |
|
|
588 |
// saveButton |
|
589 |
saveButton = new Button(); |
|
590 |
saveButton.setCaption("save"); |
|
591 |
saveButton.setImmediate(true); |
|
592 |
saveButton.setWidth("-1px"); |
|
593 |
saveButton.setHeight("-1px"); |
|
594 |
saveCancelHLayout.addComponent(saveButton); |
|
595 |
|
|
596 |
// cancelButton |
|
597 |
cancelButton = new Button(); |
|
598 |
cancelButton.setCaption("cancel"); |
|
599 |
cancelButton.setImmediate(true); |
|
600 |
cancelButton.setWidth("-1px"); |
|
601 |
cancelButton.setHeight("-1px"); |
|
602 |
saveCancelHLayout.addComponent(cancelButton); |
|
603 |
|
|
604 |
return saveCancelHLayout; |
|
605 |
} |
|
606 |
|
|
607 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/component/NewTaxonBaseComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.component; |
|
10 |
|
|
11 |
import java.util.Arrays; |
|
12 |
|
|
13 |
import org.apache.log4j.Logger; |
|
14 |
|
|
15 |
import com.vaadin.annotations.AutoGenerated; |
|
16 |
import com.vaadin.data.Validator.EmptyValueException; |
|
17 |
import com.vaadin.data.util.sqlcontainer.RowId; |
|
18 |
import com.vaadin.server.Page; |
|
19 |
import com.vaadin.ui.Alignment; |
|
20 |
import com.vaadin.ui.Button; |
|
21 |
import com.vaadin.ui.Button.ClickEvent; |
|
22 |
import com.vaadin.ui.ComboBox; |
|
23 |
import com.vaadin.ui.CustomComponent; |
|
24 |
import com.vaadin.ui.GridLayout; |
|
25 |
import com.vaadin.ui.HorizontalLayout; |
|
26 |
import com.vaadin.ui.Label; |
|
27 |
import com.vaadin.ui.Notification; |
|
28 |
import com.vaadin.ui.Notification.Type; |
|
29 |
import com.vaadin.ui.TextField; |
|
30 |
import com.vaadin.ui.UI; |
|
31 |
import com.vaadin.ui.VerticalLayout; |
|
32 |
import com.vaadin.ui.Window; |
|
33 |
|
|
34 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
|
35 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
|
36 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent.Action; |
|
37 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation; |
|
38 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
|
39 |
import eu.etaxonomy.cdm.vaadin.view.INewTaxonBaseComponentListener; |
|
40 |
import eu.etaxonomy.cdm.vaadin.view.INewTaxonBaseComposite; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author cmathew |
|
44 |
* @date 2 Apr 2015 |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class NewTaxonBaseComposite extends CustomComponent implements INewTaxonBaseComposite { |
|
48 |
|
|
49 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
50 |
|
|
51 |
@AutoGenerated |
|
52 |
private VerticalLayout mainLayout; |
|
53 |
@AutoGenerated |
|
54 |
private CdmProgressComponent cdmProgressComponent; |
|
55 |
@AutoGenerated |
|
56 |
private HorizontalLayout horizontalLayout; |
|
57 |
@AutoGenerated |
|
58 |
private Button cancelButton; |
|
59 |
@AutoGenerated |
|
60 |
private Button saveButton; |
|
61 |
@AutoGenerated |
|
62 |
private GridLayout gridLayout; |
|
63 |
@AutoGenerated |
|
64 |
private ComboBox synComboBox; |
|
65 |
@AutoGenerated |
|
66 |
private Label synSecLabel; |
|
67 |
@AutoGenerated |
|
68 |
private ComboBox accTaxonSecComboBox; |
|
69 |
@AutoGenerated |
|
70 |
private Label accTaxonSecLabel; |
|
71 |
@AutoGenerated |
|
72 |
private TextField nameTextField; |
|
73 |
@AutoGenerated |
|
74 |
private Label nameLabel; |
|
75 |
@AutoGenerated |
|
76 |
private Label accTaxonNameValue; |
|
77 |
@AutoGenerated |
|
78 |
private Label accTaxonLabel; |
|
79 |
private INewTaxonBaseComponentListener listener; |
|
80 |
|
|
81 |
|
|
82 |
private final Window dialog; |
|
83 |
private final IdUuidName accTaxonIun; |
|
84 |
private final IdUuidName classificationIun; |
|
85 |
|
|
86 |
private static final Logger logger = Logger.getLogger(NewTaxonBaseComposite.class); |
|
87 |
|
|
88 |
private static final String CHOOSE_SECUNDUM_PROMPT = "Choose Secundum ...."; |
|
89 |
|
|
90 |
/** |
|
91 |
* The constructor should first build the main layout, set the |
|
92 |
* composition root and then do any custom initialization. |
|
93 |
* |
|
94 |
* The constructor will not be automatically regenerated by the |
|
95 |
* visual editor. |
|
96 |
*/ |
|
97 |
public NewTaxonBaseComposite(Window dialog, |
|
98 |
INewTaxonBaseComponentListener listener, |
|
99 |
IdUuidName accTaxonIun, |
|
100 |
String accTaxonName, |
|
101 |
IdUuidName classificationIun) { |
|
102 |
buildMainLayout(); |
|
103 |
setCompositionRoot(mainLayout); |
|
104 |
|
|
105 |
this.listener = listener; |
|
106 |
this.dialog = dialog; |
|
107 |
this.accTaxonIun = accTaxonIun; |
|
108 |
this.classificationIun = classificationIun; |
|
109 |
|
|
110 |
addUIListeners(); |
|
111 |
|
|
112 |
if(accTaxonName == null || accTaxonName.isEmpty()) { |
|
113 |
// this is the case where we create a new taxon |
|
114 |
accTaxonLabel.setVisible(false); |
|
115 |
accTaxonNameValue.setVisible(false); |
|
116 |
synSecLabel.setVisible(false); |
|
117 |
synComboBox.setVisible(false); |
|
118 |
} else { |
|
119 |
// this is the case where we create a new synonym |
|
120 |
accTaxonNameValue.setValue(accTaxonName); |
|
121 |
} |
|
122 |
init(); |
|
123 |
} |
|
124 |
|
|
125 |
public void init() { |
|
126 |
initAccTaxonSecComboBox(); |
|
127 |
if(accTaxonIun != null) { |
|
128 |
initSynSecComboBox(); |
|
129 |
} |
|
130 |
} |
|
131 |
|
|
132 |
private void initAccTaxonSecComboBox() { |
|
133 |
accTaxonSecComboBox.setNullSelectionAllowed(false); |
|
134 |
accTaxonSecComboBox.setItemCaptionPropertyId("titleCache"); |
|
135 |
accTaxonSecComboBox.setImmediate(true); |
|
136 |
if(listener != null) { |
|
137 |
accTaxonSecComboBox.setContainerDataSource(listener.getAccTaxonSecRefContainer()); |
|
138 |
Object selectedSecItemId = listener.getClassificationRefId(classificationIun.getUuid()); |
|
139 |
if(selectedSecItemId != null) { |
|
140 |
accTaxonSecComboBox.setValue(selectedSecItemId); |
|
141 |
} else { |
|
142 |
accTaxonSecComboBox.setInputPrompt(CHOOSE_SECUNDUM_PROMPT); |
|
143 |
} |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
private void initSynSecComboBox() { |
|
148 |
synComboBox.setNullSelectionAllowed(false); |
|
149 |
synComboBox.setItemCaptionPropertyId("titleCache"); |
|
150 |
synComboBox.setImmediate(true); |
|
151 |
if(listener != null) { |
|
152 |
synComboBox.setContainerDataSource(listener.getSynSecRefContainer()); |
|
153 |
Object selectedSecItemId = listener.getClassificationRefId(classificationIun.getUuid()); |
|
154 |
if(selectedSecItemId != null) { |
|
155 |
synComboBox.setValue(selectedSecItemId); |
|
156 |
} else { |
|
157 |
synComboBox.setInputPrompt(CHOOSE_SECUNDUM_PROMPT); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
private void addUIListeners() { |
|
165 |
addSaveButtonListener(); |
|
166 |
addCancelButtonListener(); |
|
167 |
} |
|
168 |
|
|
169 |
private void addSaveButtonListener() { |
|
170 |
saveButton.addClickListener(new Button.ClickListener() { |
|
171 |
|
|
172 |
@Override |
|
173 |
public void buttonClick(ClickEvent event) { |
|
174 |
try { |
|
175 |
nameTextField.validate(); |
|
176 |
accTaxonSecComboBox.validate(); |
|
177 |
if(accTaxonIun != null) { |
|
178 |
synComboBox.validate(); |
|
179 |
} |
|
180 |
} catch (EmptyValueException e) { |
|
181 |
Notification notification = new Notification("Invalid input", "Neither Name or Secundum can be empty", Type.WARNING_MESSAGE); |
|
182 |
notification.show(Page.getCurrent()); |
|
183 |
return; |
|
184 |
} |
|
185 |
|
|
186 |
CdmVaadinUtilities.setEnabled(mainLayout, false, null); |
|
187 |
|
|
188 |
CdmVaadinUtilities.exec(new CdmVaadinOperation(500, cdmProgressComponent) { |
|
189 |
@Override |
|
190 |
public boolean execute() { |
|
191 |
setProgress("Saving Taxon " + nameTextField.getValue()); |
|
192 |
IdUuidName taxonBaseIdUuid; |
|
193 |
boolean newTaxon = false; |
|
194 |
try { |
|
195 |
if(accTaxonIun == null) { |
|
196 |
taxonBaseIdUuid = listener.newTaxon(nameTextField.getValue(),accTaxonSecComboBox.getValue(), classificationIun.getUuid()); |
|
197 |
newTaxon = true; |
|
198 |
} else { |
|
199 |
taxonBaseIdUuid = listener.newSynonym(nameTextField.getValue(), |
|
200 |
accTaxonSecComboBox.getValue(), |
|
201 |
accTaxonSecComboBox.getValue(), |
|
202 |
accTaxonIun.getUuid()); |
|
203 |
newTaxon = false; |
|
204 |
} |
|
205 |
Object rowId = new RowId(taxonBaseIdUuid.getId()); |
|
206 |
registerDelayedEvent(new CdmChangeEvent(Action.Create, Arrays.asList(rowId, newTaxon), NewTaxonBaseComposite.this)); |
|
207 |
} catch (IllegalArgumentException iae) { |
|
208 |
setException(iae); |
|
209 |
return false; |
|
210 |
} |
|
211 |
return true; |
|
212 |
} |
|
213 |
|
|
214 |
@Override |
|
215 |
public void postOpUIUpdate(boolean success) { |
|
216 |
if(success) { |
|
217 |
UI.getCurrent().removeWindow(dialog); |
|
218 |
} else { |
|
219 |
CdmVaadinUtilities.setEnabled(mainLayout, true, null); |
|
220 |
} |
|
221 |
} |
|
222 |
}); |
|
223 |
} |
|
224 |
}); |
|
225 |
} |
|
226 |
|
|
227 |
private void addCancelButtonListener() { |
|
228 |
cancelButton.addClickListener(new Button.ClickListener() { |
|
229 |
|
|
230 |
@Override |
|
231 |
public void buttonClick(ClickEvent event) { |
|
232 |
UI.getCurrent().removeWindow(dialog); |
|
233 |
} |
|
234 |
|
|
235 |
}); |
|
236 |
} |
|
237 |
|
|
238 |
/* (non-Javadoc) |
|
239 |
* @see eu.etaxonomy.cdm.vaadin.view.INewTaxonComposite#setListener(eu.etaxonomy.cdm.vaadin.view.INewTaxonBaseComponentListener) |
|
240 |
*/ |
|
241 |
@Override |
|
242 |
public void setListener(INewTaxonBaseComponentListener listener) { |
|
243 |
this.listener = listener; |
|
244 |
|
|
245 |
} |
|
246 |
|
|
247 |
@AutoGenerated |
|
248 |
private VerticalLayout buildMainLayout() { |
|
249 |
// common part: create layout |
|
250 |
mainLayout = new VerticalLayout(); |
|
251 |
mainLayout.setImmediate(false); |
|
252 |
mainLayout.setWidth("420px"); |
|
253 |
mainLayout.setHeight("240px"); |
|
254 |
mainLayout.setMargin(true); |
|
255 |
|
|
256 |
// top-level component properties |
|
257 |
setWidth("420px"); |
|
258 |
setHeight("240px"); |
|
259 |
|
|
260 |
// gridLayout |
|
261 |
gridLayout = buildGridLayout(); |
|
262 |
mainLayout.addComponent(gridLayout); |
|
263 |
mainLayout.setExpandRatio(gridLayout, 1.0f); |
|
264 |
|
|
265 |
// horizontalLayout |
|
266 |
horizontalLayout = buildHorizontalLayout(); |
|
267 |
mainLayout.addComponent(horizontalLayout); |
|
268 |
mainLayout.setComponentAlignment(horizontalLayout, new Alignment(20)); |
|
269 |
|
|
270 |
// cdmProgressComponent |
|
271 |
cdmProgressComponent = new CdmProgressComponent(); |
|
272 |
cdmProgressComponent.setImmediate(false); |
|
273 |
cdmProgressComponent.setWidth("-1px"); |
|
274 |
cdmProgressComponent.setHeight("-1px"); |
|
275 |
mainLayout.addComponent(cdmProgressComponent); |
|
276 |
mainLayout.setComponentAlignment(cdmProgressComponent, new Alignment(48)); |
|
277 |
|
|
278 |
return mainLayout; |
|
279 |
} |
|
280 |
|
|
281 |
@AutoGenerated |
|
282 |
private GridLayout buildGridLayout() { |
|
283 |
// common part: create layout |
|
284 |
gridLayout = new GridLayout(); |
|
285 |
gridLayout.setImmediate(false); |
|
286 |
gridLayout.setWidth("-1px"); |
|
287 |
gridLayout.setHeight("140px"); |
|
288 |
gridLayout.setMargin(false); |
|
289 |
gridLayout.setSpacing(true); |
|
290 |
gridLayout.setColumns(2); |
|
291 |
gridLayout.setRows(4); |
|
292 |
|
|
293 |
// accTaxonLabel |
|
294 |
accTaxonLabel = new Label(); |
|
295 |
accTaxonLabel.setImmediate(false); |
|
296 |
accTaxonLabel.setWidth("-1px"); |
|
297 |
accTaxonLabel.setHeight("-1px"); |
|
298 |
accTaxonLabel.setValue("Acc. Taxon : "); |
|
299 |
gridLayout.addComponent(accTaxonLabel, 0, 0); |
|
300 |
gridLayout.setComponentAlignment(accTaxonLabel, new Alignment(34)); |
|
301 |
|
|
302 |
// accTaxonNameValue |
|
303 |
accTaxonNameValue = new Label(); |
|
304 |
accTaxonNameValue.setImmediate(false); |
|
305 |
accTaxonNameValue.setWidth("-1px"); |
|
306 |
accTaxonNameValue.setHeight("-1px"); |
|
307 |
accTaxonNameValue.setValue("Taxon Name"); |
|
308 |
gridLayout.addComponent(accTaxonNameValue, 1, 0); |
|
309 |
gridLayout.setComponentAlignment(accTaxonNameValue, new Alignment(33)); |
|
310 |
|
|
311 |
// nameLabel |
|
312 |
nameLabel = new Label(); |
|
313 |
nameLabel.setImmediate(false); |
|
314 |
nameLabel.setWidth("-1px"); |
|
315 |
nameLabel.setHeight("-1px"); |
|
316 |
nameLabel.setValue("Name : "); |
|
317 |
gridLayout.addComponent(nameLabel, 0, 1); |
|
318 |
gridLayout.setComponentAlignment(nameLabel, new Alignment(34)); |
|
319 |
|
|
320 |
// nameTextField |
|
321 |
nameTextField = new TextField(); |
|
322 |
nameTextField.setImmediate(false); |
|
323 |
nameTextField.setWidth("190px"); |
|
324 |
nameTextField.setHeight("-1px"); |
|
325 |
nameTextField.setInvalidAllowed(false); |
|
326 |
nameTextField.setRequired(true); |
|
327 |
gridLayout.addComponent(nameTextField, 1, 1); |
|
328 |
gridLayout.setComponentAlignment(nameTextField, new Alignment(33)); |
|
329 |
|
|
330 |
// accTaxonSecLabel |
|
331 |
accTaxonSecLabel = new Label(); |
|
332 |
accTaxonSecLabel.setImmediate(false); |
|
333 |
accTaxonSecLabel.setWidth("-1px"); |
|
334 |
accTaxonSecLabel.setHeight("-1px"); |
|
335 |
accTaxonSecLabel.setValue("Acc. Taxon Secundum : "); |
|
336 |
gridLayout.addComponent(accTaxonSecLabel, 0, 2); |
|
337 |
gridLayout.setComponentAlignment(accTaxonSecLabel, new Alignment(34)); |
|
338 |
|
|
339 |
// accTaxonSecComboBox |
|
340 |
accTaxonSecComboBox = new ComboBox(); |
|
341 |
accTaxonSecComboBox.setImmediate(false); |
|
342 |
accTaxonSecComboBox.setWidth("190px"); |
|
343 |
accTaxonSecComboBox.setHeight("-1px"); |
|
344 |
accTaxonSecComboBox.setInvalidAllowed(false); |
|
345 |
accTaxonSecComboBox.setRequired(true); |
|
346 |
gridLayout.addComponent(accTaxonSecComboBox, 1, 2); |
|
347 |
gridLayout.setComponentAlignment(accTaxonSecComboBox, new Alignment(33)); |
|
348 |
|
|
349 |
// synSecLabel |
|
350 |
synSecLabel = new Label(); |
|
351 |
synSecLabel.setImmediate(false); |
|
352 |
synSecLabel.setWidth("-1px"); |
|
353 |
synSecLabel.setHeight("-1px"); |
|
354 |
synSecLabel.setValue("Synonym Secundum : "); |
|
355 |
gridLayout.addComponent(synSecLabel, 0, 3); |
|
356 |
|
|
357 |
// synComboBox |
|
358 |
synComboBox = new ComboBox(); |
|
359 |
synComboBox.setImmediate(false); |
|
360 |
synComboBox.setWidth("190px"); |
|
361 |
synComboBox.setHeight("-1px"); |
|
362 |
synComboBox.setInvalidAllowed(false); |
|
363 |
synComboBox.setRequired(true); |
|
364 |
gridLayout.addComponent(synComboBox, 1, 3); |
|
365 |
|
|
366 |
return gridLayout; |
|
367 |
} |
|
368 |
|
|
369 |
@AutoGenerated |
|
370 |
private HorizontalLayout buildHorizontalLayout() { |
|
371 |
// common part: create layout |
|
372 |
horizontalLayout = new HorizontalLayout(); |
|
373 |
horizontalLayout.setImmediate(false); |
|
374 |
horizontalLayout.setWidth("-1px"); |
|
375 |
horizontalLayout.setHeight("-1px"); |
|
376 |
horizontalLayout.setMargin(false); |
|
377 |
horizontalLayout.setSpacing(true); |
|
378 |
|
|
379 |
// saveButton |
|
380 |
saveButton = new Button(); |
|
381 |
saveButton.setCaption("Save"); |
|
382 |
saveButton.setImmediate(true); |
|
383 |
saveButton.setWidth("-1px"); |
|
384 |
saveButton.setHeight("-1px"); |
|
385 |
horizontalLayout.addComponent(saveButton); |
|
386 |
horizontalLayout.setComponentAlignment(saveButton, new Alignment(20)); |
|
387 |
|
|
388 |
// cancelButton |
|
389 |
cancelButton = new Button(); |
|
390 |
cancelButton.setCaption("Cancel"); |
|
391 |
cancelButton.setImmediate(true); |
|
392 |
cancelButton.setWidth("-1px"); |
|
393 |
cancelButton.setHeight("-1px"); |
|
394 |
horizontalLayout.addComponent(cancelButton); |
|
395 |
horizontalLayout.setComponentAlignment(cancelButton, new Alignment(20)); |
|
396 |
|
|
397 |
return horizontalLayout; |
|
398 |
} |
|
399 |
|
|
400 |
|
|
401 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/component/StatusComposite.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.component; |
|
10 |
|
|
11 |
import java.sql.SQLException; |
|
12 |
import java.util.Arrays; |
|
13 |
import java.util.UUID; |
|
14 |
|
|
15 |
import org.apache.log4j.Logger; |
|
16 |
import org.vaadin.peter.contextmenu.ContextMenu; |
|
17 |
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItem; |
|
18 |
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItemClickEvent; |
|
19 |
import org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItemClickListener; |
|
20 |
|
|
21 |
import com.vaadin.annotations.AutoGenerated; |
|
22 |
import com.vaadin.data.Item; |
|
23 |
import com.vaadin.data.Property; |
|
24 |
import com.vaadin.data.Property.ValueChangeEvent; |
|
25 |
import com.vaadin.data.Property.ValueChangeListener; |
|
26 |
import com.vaadin.data.util.IndexedContainer; |
|
27 |
import com.vaadin.data.util.sqlcontainer.RowId; |
|
28 |
import com.vaadin.event.FieldEvents; |
|
29 |
import com.vaadin.event.FieldEvents.TextChangeEvent; |
|
30 |
import com.vaadin.event.ItemClickEvent; |
|
31 |
import com.vaadin.event.ItemClickEvent.ItemClickListener; |
|
32 |
import com.vaadin.event.LayoutEvents.LayoutClickEvent; |
|
33 |
import com.vaadin.event.LayoutEvents.LayoutClickListener; |
|
34 |
import com.vaadin.navigator.View; |
|
35 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
36 |
import com.vaadin.server.FontAwesome; |
|
37 |
import com.vaadin.ui.Alignment; |
|
38 |
import com.vaadin.ui.Button; |
|
39 |
import com.vaadin.ui.Button.ClickEvent; |
|
40 |
import com.vaadin.ui.CheckBox; |
|
41 |
import com.vaadin.ui.ComboBox; |
|
42 |
import com.vaadin.ui.Component; |
|
43 |
import com.vaadin.ui.CustomComponent; |
|
44 |
import com.vaadin.ui.GridLayout; |
|
45 |
import com.vaadin.ui.HorizontalLayout; |
|
46 |
import com.vaadin.ui.Label; |
|
47 |
import com.vaadin.ui.Notification; |
|
48 |
import com.vaadin.ui.Notification.Type; |
|
49 |
import com.vaadin.ui.TabSheet; |
|
50 |
import com.vaadin.ui.Table; |
|
51 |
import com.vaadin.ui.Table.ColumnHeaderMode; |
|
52 |
import com.vaadin.ui.Table.TableDragMode; |
|
53 |
import com.vaadin.ui.TextField; |
|
54 |
import com.vaadin.ui.TreeTable; |
|
55 |
import com.vaadin.ui.UI; |
|
56 |
import com.vaadin.ui.VerticalLayout; |
|
57 |
import com.vaadin.ui.Window; |
|
58 |
|
|
59 |
import eu.etaxonomy.cdm.vaadin.container.IdUuidName; |
|
60 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
|
61 |
import eu.etaxonomy.cdm.vaadin.presenter.NewTaxonBasePresenter; |
|
62 |
import eu.etaxonomy.cdm.vaadin.presenter.StatusPresenter; |
|
63 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
|
64 |
import eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener; |
|
65 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
|
66 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinOperation; |
|
67 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
|
68 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinUtilities; |
|
69 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite; |
|
70 |
|
|
71 |
/** |
|
72 |
* @author cmathew |
|
73 |
* @date 11 Mar 2015 |
|
74 |
* |
|
75 |
*/ |
|
76 |
public class StatusComposite extends CustomComponent implements View, IStatusComposite, ICdmChangeListener { |
|
77 |
|
|
78 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
79 |
|
|
80 |
@AutoGenerated |
|
81 |
private GridLayout mainLayout; |
|
82 |
@AutoGenerated |
|
83 |
private Label inViewLabel; |
|
84 |
@AutoGenerated |
|
85 |
private TabSheet taxaTabSheet; |
|
86 |
@AutoGenerated |
|
87 |
private HorizontalLayout searchHorizontalLayout; |
|
88 |
@AutoGenerated |
|
89 |
private Button clearSearchButton; |
|
90 |
@AutoGenerated |
|
91 |
private TextField searchTextField; |
|
92 |
@AutoGenerated |
|
93 |
private VerticalLayout filterVerticalLayout; |
|
94 |
@AutoGenerated |
|
95 |
private Table filterTable; |
|
96 |
@AutoGenerated |
|
97 |
private Label filterLabel; |
|
98 |
@AutoGenerated |
|
99 |
private ComboBox classificationComboBox; |
|
100 |
private static final Logger logger = Logger.getLogger(StatusComposite.class); |
|
101 |
private StatusComponentListener listener; |
|
102 |
|
|
103 |
private TreeTable mainTaxaTreeTable, excludedTaxaTreeTable; |
|
104 |
|
|
105 |
|
|
106 |
private static final String SELECT_CLASSIFICATION = "Select classification ..."; |
Also available in: Unified diff
refactoring package structure