Revision 092fd728
Added by Patrick Plitzner over 7 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java | ||
---|---|---|
6 | 6 |
import java.util.List; |
7 | 7 |
import java.util.UUID; |
8 | 8 |
|
9 |
import com.vaadin.data.Item; |
|
9 | 10 |
import com.vaadin.data.Property; |
10 | 11 |
import com.vaadin.event.ItemClickEvent; |
11 | 12 |
import com.vaadin.event.ItemClickEvent.ItemClickListener; |
... | ... | |
93 | 94 |
|
94 | 95 |
@Override |
95 | 96 |
public void enter(ViewChangeEvent event) { |
96 |
CdmSQLContainer container = null;
|
|
97 |
final CdmSQLContainer container;
|
|
97 | 98 |
try { |
98 | 99 |
container = listener.getSQLContainer(); |
99 | 100 |
} catch (SQLException e) { |
... | ... | |
122 | 123 |
table.setPageLength(20); |
123 | 124 |
table.setFooterVisible(true); |
124 | 125 |
table.setColumnFooter(CdmQueryFactory.TAXON_COLUMN, "Total amount of Taxa displayed: " + container.size()); |
125 |
|
|
126 | 126 |
table.setCacheRate(20); |
127 | 127 |
|
128 | 128 |
table.addItemClickListener(new ItemClickListener() { |
... | ... | |
130 | 130 |
@Override |
131 | 131 |
public void itemClick(ItemClickEvent event) { |
132 | 132 |
if(!(event.getPropertyId().toString().equalsIgnoreCase(CdmQueryFactory.TAXON_COLUMN)) && !(event.getPropertyId().toString().equalsIgnoreCase(CdmQueryFactory.RANK_COLUMN))){ |
133 |
Property<?> itemProperty = event.getItem().getItemProperty("uuid"); |
|
133 |
final Item item = event.getItem(); |
|
134 |
Property<?> itemProperty = item.getItemProperty("uuid"); |
|
134 | 135 |
UUID uuid = UUID.fromString(itemProperty.getValue().toString()); |
135 | 136 |
final Taxon taxon = HibernateProxyHelper.deproxy(listener.getTaxonService().load(uuid), Taxon.class); |
136 | 137 |
final String areaID = (String) event.getPropertyId(); |
137 | 138 |
|
138 | 139 |
//popup window |
139 |
final Window popup = new Window("Choose terms");
|
|
140 |
final Window popup = new Window("Choose distribution status");
|
|
140 | 141 |
final ListSelect termSelect = new ListSelect(); |
141 | 142 |
termSelect.setContainerDataSource(PresenceAbsenceTermContainer.getInstance()); |
142 | 143 |
Button btnOk = new Button("OK", new ClickListener() { |
143 | 144 |
private static final long serialVersionUID = -3732219609337335697L; |
144 | 145 |
@Override |
145 | 146 |
public void buttonClick(ClickEvent event) { |
146 |
listener.updateDistributionField(areaID, termSelect.getValue(), taxon); |
|
147 |
Object distributionStatus = termSelect.getValue(); |
|
148 |
listener.updateDistributionField(areaID, distributionStatus, taxon); |
|
149 |
container.refresh(); |
|
147 | 150 |
popup.close(); |
148 | 151 |
} |
149 | 152 |
}); |
Also available in: Unified diff
ref #5458 Update selected distribution status after selection