Project

General

Profile

Revision 8e77cee7

ID8e77cee7bd10fc4bc49c8b6eb924a858cea9995e
Parent 4936cc81
Child 164795a7

Added by Alexander Oppermann over 6 years ago

Vaadin Exception handling and minor changes

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/components/DemoTaxonTable.java
68 68
	 * automatic generated ID
69 69
	 */
70 70
	@Autowired
71
	IVocabularyService vocabularyService;
71
	transient IVocabularyService vocabularyService;
72 72
	@Autowired
73
	ITaxonService taxonService;
73
	transient ITaxonService taxonService;
74 74
	@Autowired
75
	IDescriptionService descriptionService;
75
	transient IDescriptionService descriptionService;
76 76
	@Autowired
77
	ITermService termService;
77
	transient ITermService termService;
78 78
	@Autowired
79
	IClassificationService clService;
79
	transient IClassificationService clService;
80 80
	@Autowired
81
	ITaxonNodeService taxonNodeService;
81
	transient ITaxonNodeService taxonNodeService;
82 82
	@Autowired
83
	IClassificationService classificationService;
83
	transient IClassificationService classificationService;
84 84

  
85 85
	Logger logger = Logger.getLogger(DemoTaxonTable.class);
86 86
	
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/vaadin/uiset/redlist/views/BfnView.java
14 14

  
15 15
import ru.xpoft.vaadin.VaadinView;
16 16

  
17
import com.vaadin.annotations.PreserveOnRefresh;
17 18
import com.vaadin.annotations.Theme;
18 19
import com.vaadin.data.Container;
19 20
import com.vaadin.data.Property;
......
54 55
@Component
55 56
@Scope("prototype")
56 57
@Theme("mytheme")
57
@VaadinView(value = BfnView.NAME, cached=true)
58
@VaadinView(BfnView.NAME)
59
@PreserveOnRefresh
58 60
public class BfnView extends CustomComponent implements View{
59 61

  
60 62
	private static final long serialVersionUID = 1L;
......
62 64
	public static final String NAME = "bfn";
63 65

  
64 66
	@Autowired
65
	private VaadinAuthenticationService authenticationController;
67
	private transient VaadinAuthenticationService authenticationController;
66 68

  
67 69
	@Autowired
68
	private HorizontalToolbar toolbar;
70
	private transient HorizontalToolbar toolbar;
69 71

  
70 72
	@Autowired
71
	private DemoTaxonTable taxonTable;
73
	private transient DemoTaxonTable taxonTable;
72 74

  
73 75
	private VerticalLayout layout;
74 76
	@Autowired
75
	private ITermService termService;
77
	private transient ITermService termService;
76 78
	@Autowired
77
	private ITaxonService taxonService;
79
	private transient ITaxonService taxonService;
78 80
	@Autowired
79
	private IDescriptionService descriptionService;
81
	private transient IDescriptionService descriptionService;
80 82
	@Autowired
81
	private IVocabularyService vocabularyService;
83
	private transient IVocabularyService vocabularyService;
82 84

  
83 85
	private Taxon currentTaxon;
84 86

  
......
156 158

  
157 159
			@Override
158 160
			public void buttonClick(ClickEvent event) {
161
				try{
159 162
				if(currentTaxon != null){
160 163
					List<DescriptionElementBase> listDescriptions = descriptionService.listDescriptionElementsForTaxon(currentTaxon, null, null, null, null, DESCRIPTION_INIT_STRATEGY);
161 164
					DetailWindow dw = new DetailWindow(currentTaxon, listDescriptions);
......
164 167
				}else{
165 168
					Notification.show("Please select a Taxon.", Notification.Type.HUMANIZED_MESSAGE);
166 169
				}
170
				}catch(Exception e){
171
					Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
172
					logger.info(e);
173
					authenticationController.logout();
174
				}
167 175
			}
168 176
		});
169 177

  
......
177 185
			@Override
178 186
			public void buttonClick(ClickEvent event) {
179 187
				ConversationHolder conversationHolder = authenticationController.getConversationHolder();
180
//				try{
188
				try{
181 189
					conversationHolder.commit();
182
//				}catch(IllegalStateException stateException){
190
				}catch(Exception stateException){
183 191
					//TODO create Table without DTO
184
//					Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
185
//					logger.info(stateException);
186
//					authenticationController.logout();
192
					Notification.show("Unexpected Error, \n\n Please log in again!", Notification.Type.WARNING_MESSAGE);
193
					logger.info(stateException);
194
					authenticationController.logout();
187 195
//					conversationHolder.startTransaction();
188 196
//					conversationHolder.commit();
189
//				}
197
				}
190 198
				Notification.show("Data saved", Notification.Type.HUMANIZED_MESSAGE);
191 199
				taxonTable.setEditable(false);
192 200
				toolbar.getSaveButton().setCaption("Save Data");

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)