Project

General

Profile

Revision 6f0224b6

ID6f0224b6cade7ea34ff32f25637cfe009fcb72a1
Parent 9f8c87ee
Child 3ed14411

Added by Patrick Plitzner almost 4 years ago

ref #5458 Do view data binding in enter() method of table view

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/presenter/dbstatus/DistributionTablePresenter.java
61 61
		vocabularyService = CdmSpringContextHelper.getVocabularyService();
62 62
		descriptionService = CdmSpringContextHelper.getDescriptionService();
63 63
		termService = CdmSpringContextHelper.getTermService();
64
		view.dataBinding();
65 64
	}
66 65

  
67 66

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java
22 22
import com.vaadin.ui.ComboBox;
23 23
import com.vaadin.ui.CustomComponent;
24 24
import com.vaadin.ui.Notification;
25
import com.vaadin.ui.Notification.Type;
25 26
import com.vaadin.ui.Table;
26 27
import com.vaadin.ui.Table.ColumnGenerator;
27 28
import com.vaadin.ui.Window;
......
117 118
	   this.listener = listener;
118 119
	}
119 120

  
120
    @Override
121
    public void enter(ViewChangeEvent event) {
122
    }
123

  
124
	public void dataBinding() throws SQLException{
125
		CdmSQLContainer container = listener.getSQLContainer();
121
	@Override
122
	public void enter(ViewChangeEvent event) {
123
		CdmSQLContainer container = null;
124
		try {
125
			container = listener.getSQLContainer();
126
		} catch (SQLException e) {
127
			Notification.show("Could not acces data base", Type.ERROR_MESSAGE);
128
			e.printStackTrace();
129
			return;
130
		}
126 131

  
127 132
		table.setContainerDataSource(container);
128 133
		table.setColumnReorderingAllowed(true);
......
144 149
		table.setColumnFooter(CdmQueryFactory.TAXON_COLUMN, "Total amount of Taxa displayed: " + container.size());
145 150

  
146 151
		table.setCacheRate(20);
147
		
152

  
148 153
		//add generated columns for NamedAreas
149 154
		Collection<?> containerPropertyIds = table.getContainerPropertyIds();
150 155
		for (Object object : containerPropertyIds) {
151 156
			if(termList.contains(object)){
152
				  table.addGeneratedColumn(object, new AreaColumnGenerator());
157
				table.addGeneratedColumn(object, new AreaColumnGenerator());
153 158
			}
154 159
		}
155 160
	}
156 161

  
157

  
158 162
	private void createEditClickListener(){
159 163
		Button detailButton = toolbar.getDetailButton();
160 164
		detailButton.setCaption("Detail View");
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/SettingsConfigWindow.java
9 9
*/
10 10
package eu.etaxonomy.cdm.vaadin.view.dbstatus;
11 11

  
12
import java.sql.SQLException;
13

  
14 12
import com.vaadin.data.Container;
15 13
import com.vaadin.data.Property.ValueChangeEvent;
16 14
import com.vaadin.data.Property.ValueChangeListener;
......
34 32
import eu.etaxonomy.cdm.model.common.TermVocabulary;
35 33
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
36 34
import eu.etaxonomy.cdm.vaadin.container.TaxonNodeContainer;
37
import eu.etaxonomy.cdm.vaadin.presenter.dbstatus.DistributionTablePresenter;
38 35
import eu.etaxonomy.cdm.vaadin.presenter.dbstatus.settings.SettingsPresenter;
39 36

  
40 37
/**
......
112 109
			    VaadinSession.getCurrent().setAttribute("taxonNodeUUID", taxonNode.getUuid());
113 110
			    VaadinSession.getCurrent().setAttribute("selectedTerm", term.getUuid());
114 111

  
115
			    DistributionTableView dtv = new DistributionTableView();
116
			    try {
117
					new DistributionTablePresenter(dtv);
118
				} catch (SQLException e) {
119
					e.printStackTrace();
120
				}
121
			    UI.getCurrent().getNavigator().addView("table", dtv);
122
			    //navigate to table view
123 112
			    window.close();
124 113
		        UI.getCurrent().getNavigator().navigateTo("table");				
125 114
			}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)