Project

General

Profile

« Previous | Next » 

Revision ce1318e1

Added by Patrick Plitzner over 6 years ago

ref #5458 Enhance detail window messages

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/DetailWindow.java
6 6
import com.vaadin.event.ShortcutAction.KeyCode;
7 7
import com.vaadin.event.ShortcutAction.ModifierKey;
8 8
import com.vaadin.ui.CustomComponent;
9
import com.vaadin.ui.Label;
9 10
import com.vaadin.ui.Tree;
10 11
import com.vaadin.ui.Window;
11 12

  
......
36 37
	public Window createWindow(){
37 38
		Window window = new Window();
38 39
		window.setHeightUndefined();
39
//		window.setHeight("600px");
40
//		window.setWidth("400px");
40
		window.setHeight("600px");
41
		window.setWidth("400px");
41 42
		window.setCaption(taxon.getName().getTitleCache());
42 43
		window.setCloseShortcut(KeyCode.W, ModifierKey.CTRL);
43
		window.setContent(constructDescriptionTree(taxon));
44
		if(listDescriptions.isEmpty()){
45
			window.setContent(new Label("No descriptive data found"));
46
		}
47
		else{
48
			window.setContent(constructDescriptionTree(taxon));
49
		}
44 50
		return window;
45 51
	}
46 52

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/dbstatus/DistributionTableView.java
169 169

  
170 170
			@Override
171 171
			public void buttonClick(ClickEvent event) {
172
				try{
173
					Object selectedItemId = DistributionTableView.this.table.getValue();
174
				    final UUID uuid = UUID.fromString(table.getItem(selectedItemId).getItemProperty("uuid").getValue().toString());
175
		            Taxon taxon = HibernateProxyHelper.deproxy(listener.getTaxonService().load(uuid), Taxon.class);
172
				Object selectedItemId = DistributionTableView.this.table.getValue();
173
				if(selectedItemId!=null){
174
					final UUID uuid = UUID.fromString(table.getItem(selectedItemId).getItemProperty("uuid").getValue().toString());
175
					Taxon taxon = HibernateProxyHelper.deproxy(listener.getTaxonService().load(uuid), Taxon.class);
176 176
					List<DescriptionElementBase> listDescriptions = listener.listDescriptionElementsForTaxon(taxon, null);
177 177
					DetailWindow dw = new DetailWindow(taxon, listDescriptions);
178 178
					Window window = dw.createWindow();
179 179
					getUI().addWindow(window);
180
				}catch(Exception e){
181
					Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
180
				}
181
				else{
182
					Notification.show("Please select a taxon", Type.HUMANIZED_MESSAGE);
182 183
				}
183 184
			}
184 185
		});

Also available in: Unified diff