Revision 8ef14383
Added by Alexander Oppermann about 9 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.cdm.vaadin.view.dbstatus; |
2 | 2 |
|
3 |
import java.sql.SQLException; |
|
3 | 4 |
import java.util.ArrayList; |
4 | 5 |
import java.util.Arrays; |
5 | 6 |
import java.util.HashMap; |
... | ... | |
12 | 13 |
import com.vaadin.data.Container; |
13 | 14 |
import com.vaadin.data.Property; |
14 | 15 |
import com.vaadin.data.Property.ValueChangeListener; |
15 |
import com.vaadin.data.util.BeanItem; |
|
16 | 16 |
import com.vaadin.data.util.BeanItemContainer; |
17 |
import com.vaadin.event.ItemClickEvent; |
|
18 |
import com.vaadin.event.ItemClickEvent.ItemClickListener; |
|
19 | 17 |
import com.vaadin.event.ShortcutAction.KeyCode; |
20 | 18 |
import com.vaadin.event.ShortcutAction.ModifierKey; |
21 | 19 |
import com.vaadin.navigator.View; |
... | ... | |
46 | 44 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
47 | 45 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
48 | 46 |
import eu.etaxonomy.cdm.vaadin.component.HorizontalToolbar; |
49 |
import eu.etaxonomy.cdm.vaadin.model.CdmTaxonTableCollection; |
|
50 |
import eu.etaxonomy.cdm.vaadin.model.LazyLoadedContainer; |
|
47 |
import eu.etaxonomy.cdm.vaadin.container.CdmSQLContainer; |
|
51 | 48 |
|
52 | 49 |
public class DistributionTableView extends CustomComponent implements IDistributionTableComponent, View{ |
53 | 50 |
|
... | ... | |
125 | 122 |
|
126 | 123 |
|
127 | 124 |
|
128 |
public void dataBinding(){ |
|
125 |
public void dataBinding() throws SQLException{
|
|
129 | 126 |
|
130 | 127 |
// container.addNestedContainerProperty("dDTO.status"); |
131 |
final LazyLoadedContainer container = listener.getLazyLoadedContainer(); |
|
132 |
Set<DefinedTermBase> chosenTerms = listener.getChosenTerms(); |
|
133 |
generateDsitributionColumn(chosenTerms); |
|
128 |
// final LazyLoadedContainer container = listener.getLazyLoadedContainer(); |
|
129 |
// Set<DefinedTermBase> chosenTerms = listener.getChosenTerms(); |
|
130 |
// generateDsitributionColumn(chosenTerms); |
|
131 |
|
|
132 |
CdmSQLContainer container = listener.getSQLContainer(); |
|
134 | 133 |
|
135 | 134 |
table_1.setContainerDataSource(container); |
136 | 135 |
table_1.setColumnReorderingAllowed(true); |
137 |
table_1.setSortEnabled(false);
|
|
136 |
table_1.setSortEnabled(true);
|
|
138 | 137 |
// setVisibleColumns(columns); |
139 |
Object[] visibleColumns = columnList.toArray(); |
|
140 |
table_1.setVisibleColumns(visibleColumns); |
|
141 |
table_1.setColumnHeaders(headerList.toArray(new String[headerList.size()]));//new String[]{"Taxon", "Rang"});// ,"Deutschland" |
|
138 |
// Object[] visibleColumns = columnList.toArray(); |
|
139 |
// table_1.setVisibleColumns(visibleColumns); |
|
140 |
// table_1.setColumnHeaders(headerList.toArray(new String[headerList.size()]));//new String[]{"Taxon", "Rang"});// ,"Deutschland" |
|
141 |
|
|
142 | 142 |
table_1.setColumnCollapsingAllowed(true); |
143 | 143 |
table_1.setSelectable(true); |
144 | 144 |
// table_1.setSizeUndefined(); |
145 | 145 |
// setSizeFull(); |
146 | 146 |
table_1.setPageLength(20); |
147 | 147 |
table_1.setFooterVisible(true); |
148 |
table_1.setColumnFooter("fullTitleCache", "Total amount of Taxa displayed: " + container.size());
|
|
148 |
table_1.setColumnFooter("Taxon", "Total amount of Taxa displayed: " + container.size());
|
|
149 | 149 |
|
150 | 150 |
table_1.setCacheRate(10); |
151 | 151 |
} |
... | ... | |
389 | 389 |
} |
390 | 390 |
}); |
391 | 391 |
|
392 |
table_1.addItemClickListener(new ItemClickListener() { |
|
393 |
|
|
394 |
@Override |
|
395 |
public void itemClick(ItemClickEvent event) { |
|
396 |
Object taxonbean = ((BeanItem<?>)event.getItem()).getBean(); |
|
397 |
if(taxonbean instanceof CdmTaxonTableCollection){ |
|
398 |
CdmTaxonTableCollection red = (CdmTaxonTableCollection) taxonbean; |
|
399 |
currentTaxon = red.getTaxon(); |
|
400 |
} |
|
401 |
} |
|
402 |
}); |
|
392 |
//FIXME with new SQL CONTAINER |
|
393 |
// table_1.addItemClickListener(new ItemClickListener() { |
|
394 |
// |
|
395 |
// @Override |
|
396 |
// public void itemClick(ItemClickEvent event) { |
|
397 |
// Object taxonbean = ((BeanItem<?>)event.getItem()).getBean(); |
|
398 |
// if(taxonbean instanceof CdmTaxonTableCollection){ |
|
399 |
// CdmTaxonTableCollection red = (CdmTaxonTableCollection) taxonbean; |
|
400 |
// currentTaxon = red.getTaxon(); |
|
401 |
// } |
|
402 |
// } |
|
403 |
// }); |
|
403 | 404 |
} |
404 | 405 |
|
405 | 406 |
} |
Also available in: Unified diff
Added SQL-Container to DB-Status App