Revision 45da4f57
Added by Cherian Mathew about 7 years ago
.gitattributes | ||
---|---|---|
47 | 47 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/INewTaxonBaseComponentListener.java -text |
48 | 48 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/INewTaxonBaseComposite.java -text |
49 | 49 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/IStatusComposite.java -text |
50 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/StatusEditorView.java -text |
|
51 | 50 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionSelectionView.java -text |
52 | 51 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java -text |
53 | 52 |
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/IDistributionSelectionComponent.java -text |
src/main/java/eu/etaxonomy/cdm/vaadin/component/StatusComposite.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.sql.SQLException; |
13 | 13 |
import java.util.ArrayList; |
14 |
import java.util.Arrays; |
|
14 | 15 |
import java.util.List; |
15 | 16 |
import java.util.Set; |
17 |
import java.util.UUID; |
|
16 | 18 |
|
17 | 19 |
import org.apache.log4j.Logger; |
18 | 20 |
|
... | ... | |
26 | 28 |
import com.vaadin.event.Action; |
27 | 29 |
import com.vaadin.event.FieldEvents; |
28 | 30 |
import com.vaadin.event.FieldEvents.TextChangeEvent; |
31 |
import com.vaadin.event.ItemClickEvent; |
|
32 |
import com.vaadin.event.ItemClickEvent.ItemClickListener; |
|
29 | 33 |
import com.vaadin.event.LayoutEvents.LayoutClickEvent; |
30 | 34 |
import com.vaadin.event.LayoutEvents.LayoutClickListener; |
35 |
import com.vaadin.navigator.View; |
|
36 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
31 | 37 |
import com.vaadin.server.FontAwesome; |
32 | 38 |
import com.vaadin.ui.Alignment; |
33 | 39 |
import com.vaadin.ui.Button; |
... | ... | |
52 | 58 |
import eu.etaxonomy.cdm.vaadin.container.IdAndUuid; |
53 | 59 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
54 | 60 |
import eu.etaxonomy.cdm.vaadin.presenter.NewTaxonBasePresenter; |
61 |
import eu.etaxonomy.cdm.vaadin.presenter.StatusPresenter; |
|
55 | 62 |
import eu.etaxonomy.cdm.vaadin.session.CdmChangeEvent; |
56 | 63 |
import eu.etaxonomy.cdm.vaadin.session.ICdmChangeListener; |
64 |
import eu.etaxonomy.cdm.vaadin.session.SelectionEvent; |
|
57 | 65 |
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities; |
58 | 66 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite; |
59 | 67 |
|
... | ... | |
62 | 70 |
* @date 11 Mar 2015 |
63 | 71 |
* |
64 | 72 |
*/ |
65 |
public class StatusComposite extends CustomComponent implements IStatusComposite, ICdmChangeListener { |
|
73 |
public class StatusComposite extends CustomComponent implements View, IStatusComposite, ICdmChangeListener {
|
|
66 | 74 |
|
67 | 75 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
68 | 76 |
|
... | ... | |
128 | 136 |
buildMainLayout(); |
129 | 137 |
setCompositionRoot(mainLayout); |
130 | 138 |
|
139 |
this.listener = new StatusPresenter(); |
|
131 | 140 |
CdmVaadinSessionUtilities.getCurrentCdmDataChangeService().register(this); |
132 | 141 |
addUIListeners(); |
133 | 142 |
|
... | ... | |
135 | 144 |
initSearchTextField(); |
136 | 145 |
initClearSearchButton(); |
137 | 146 |
setEnabledAll(false); |
147 |
|
|
148 |
init(); |
|
149 |
} |
|
150 |
|
|
151 |
public void minimalize() { |
|
152 |
|
|
138 | 153 |
} |
139 | 154 |
|
140 | 155 |
public void init() { |
... | ... | |
333 | 348 |
}); |
334 | 349 |
|
335 | 350 |
addClassificationComboBoxListener(); |
351 |
addTaxaTreeTableListener(); |
|
336 | 352 |
addAddComboBoxListener(); |
337 | 353 |
addRemoveButtonListener(); |
338 | 354 |
addSearchTextFieldListener(); |
... | ... | |
359 | 375 |
}); |
360 | 376 |
} |
361 | 377 |
|
378 |
private void addTaxaTreeTableListener() { |
|
379 |
taxaTreeTable.addItemClickListener(new ItemClickListener() { |
|
380 |
|
|
381 |
@Override |
|
382 |
public void itemClick(ItemClickEvent event) { |
|
383 |
|
|
384 |
Object itemId = event.getItemId(); |
|
385 |
if(!listener.isSynonym(itemId)) { |
|
386 |
UUID taxonUuid = listener.getCurrentLeafNodeTaxonContainer().getUuid(itemId); |
|
387 |
CdmVaadinSessionUtilities.getCurrentSelectionService() |
|
388 |
.fireSelectionEvent(new SelectionEvent(Arrays.asList((Object)taxonUuid), StatusComposite.class), true); |
|
389 |
} |
|
390 |
} |
|
391 |
}); |
|
392 |
|
|
393 |
} |
|
362 | 394 |
|
363 | 395 |
private void addAddComboBoxListener() { |
364 | 396 |
addComboBox.addValueChangeListener(new Property.ValueChangeListener() { |
... | ... | |
715 | 747 |
|
716 | 748 |
} |
717 | 749 |
|
750 |
/* (non-Javadoc) |
|
751 |
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) |
|
752 |
*/ |
|
753 |
@Override |
|
754 |
public void enter(ViewChangeEvent event) { |
|
755 |
// TODO Auto-generated method stub |
|
756 |
|
|
757 |
} |
|
758 |
|
|
718 | 759 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/StatusPresenter.java | ||
---|---|---|
12 | 12 |
import java.sql.SQLException; |
13 | 13 |
import java.util.UUID; |
14 | 14 |
|
15 |
import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder; |
|
16 |
|
|
17 | 15 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
18 | 16 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
19 | 17 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
20 | 18 |
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer; |
21 | 19 |
import eu.etaxonomy.cdm.vaadin.container.LeafNodeTaxonContainer; |
22 | 20 |
import eu.etaxonomy.cdm.vaadin.util.CdmQueryFactory; |
23 |
import eu.etaxonomy.cdm.vaadin.util.CdmSQLStringDecorator; |
|
24 | 21 |
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper; |
25 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite; |
|
26 | 22 |
import eu.etaxonomy.cdm.vaadin.view.IStatusComposite.StatusComponentListener; |
27 | 23 |
|
28 | 24 |
/** |
... | ... | |
32 | 28 |
*/ |
33 | 29 |
public class StatusPresenter implements StatusComponentListener { |
34 | 30 |
|
35 |
private final IStatusComposite composite; |
|
31 |
|
|
36 | 32 |
|
37 | 33 |
private LeafNodeTaxonContainer container; |
38 | 34 |
|
... | ... | |
40 | 36 |
|
41 | 37 |
private int totalNoOfTaxa = 0; |
42 | 38 |
|
43 |
public StatusPresenter(IStatusComposite composite) { |
|
44 |
this.composite = composite; |
|
45 |
composite.setListener(this); |
|
46 |
// TODO: Need to evaluate the various sql dialects and make sure that these |
|
47 |
// queries are compatible with all |
|
48 |
QueryBuilder.setStringDecorator(new CdmSQLStringDecorator()); |
|
49 |
|
|
39 |
public StatusPresenter() { |
|
50 | 40 |
taxonService = CdmSpringContextHelper.getTaxonService(); |
51 | 41 |
} |
52 | 42 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/ui/StatusEditorUI.java | ||
---|---|---|
26 | 26 |
import com.vaadin.server.VaadinServlet; |
27 | 27 |
import com.vaadin.ui.UI; |
28 | 28 |
|
29 |
import eu.etaxonomy.cdm.vaadin.view.StatusEditorView;
|
|
29 |
import eu.etaxonomy.cdm.vaadin.component.StatusComposite;
|
|
30 | 30 |
|
31 | 31 |
|
32 | 32 |
@Theme("valo") |
... | ... | |
50 | 50 |
setIgnoreAuthentication(true); |
51 | 51 |
|
52 | 52 |
getPage().setTitle("Status Editor"); |
53 |
StatusEditorView statusEditorView = new StatusEditorView();
|
|
54 |
UI.getCurrent().getNavigator().addView(FIRST_VIEW, statusEditorView);
|
|
53 |
StatusComposite statusEditor = new StatusComposite();
|
|
54 |
UI.getCurrent().getNavigator().addView(FIRST_VIEW, statusEditor); |
|
55 | 55 |
|
56 | 56 |
} |
57 | 57 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/StatusEditorView.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.cdm.vaadin.view; |
|
11 |
|
|
12 |
import com.vaadin.annotations.AutoGenerated; |
|
13 |
import com.vaadin.navigator.View; |
|
14 |
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; |
|
15 |
import com.vaadin.ui.CustomComponent; |
|
16 |
import com.vaadin.ui.GridLayout; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.vaadin.component.StatusComposite; |
|
19 |
import eu.etaxonomy.cdm.vaadin.presenter.StatusPresenter; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author cmathew |
|
23 |
* @date 11 Mar 2015 |
|
24 |
* |
|
25 |
*/ |
|
26 |
public class StatusEditorView extends CustomComponent implements View { |
|
27 |
|
|
28 |
/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */ |
|
29 |
|
|
30 |
@AutoGenerated |
|
31 |
private GridLayout mainLayout; |
|
32 |
@AutoGenerated |
|
33 |
private StatusComposite statusComposite; |
|
34 |
/** |
|
35 |
* The constructor should first build the main layout, set the |
|
36 |
* composition root and then do any custom initialization. |
|
37 |
* |
|
38 |
* The constructor will not be automatically regenerated by the |
|
39 |
* visual editor. |
|
40 |
*/ |
|
41 |
public StatusEditorView() { |
|
42 |
buildMainLayout(); |
|
43 |
setCompositionRoot(mainLayout); |
|
44 |
|
|
45 |
new StatusPresenter(statusComposite); |
|
46 |
statusComposite.init(); |
|
47 |
} |
|
48 |
|
|
49 |
@AutoGenerated |
|
50 |
private GridLayout buildMainLayout() { |
|
51 |
// common part: create layout |
|
52 |
mainLayout = new GridLayout(); |
|
53 |
mainLayout.setImmediate(false); |
|
54 |
mainLayout.setWidth("100%"); |
|
55 |
mainLayout.setHeight("100%"); |
|
56 |
mainLayout.setMargin(true); |
|
57 |
mainLayout.setSpacing(true); |
|
58 |
|
|
59 |
// top-level component properties |
|
60 |
setWidth("100.0%"); |
|
61 |
setHeight("100.0%"); |
|
62 |
|
|
63 |
// statusComposite |
|
64 |
statusComposite = new StatusComposite(); |
|
65 |
statusComposite.setImmediate(false); |
|
66 |
statusComposite.setWidth("-1px"); |
|
67 |
statusComposite.setHeight("-1px"); |
|
68 |
mainLayout.addComponent(statusComposite, 0, 0); |
|
69 |
|
|
70 |
return mainLayout; |
|
71 |
} |
|
72 |
|
|
73 |
/* (non-Javadoc) |
|
74 |
* @see com.vaadin.navigator.View#enter(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent) |
|
75 |
*/ |
|
76 |
@Override |
|
77 |
public void enter(ViewChangeEvent event) { |
|
78 |
// TODO Auto-generated method stub |
|
79 |
|
|
80 |
} |
|
81 |
|
|
82 |
} |
Also available in: Unified diff
removed unnecessary StatusEditorView