Project

General

Profile

« Previous | Next » 

Revision be4a9789

Added by Andreas Kohlbecker about 6 years ago

fix #7231 replacing SpringApplicationEventBus by scoped Vaadin4Spring Event Bus

View differences:

src/main/java/eu/etaxonomy/vaadin/ui/mainmenu/ValoMainMenuBean.java
6 6
import java.util.stream.StreamSupport;
7 7

  
8 8
import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.context.ApplicationEventPublisher;
10
import org.springframework.context.event.EventListener;
9
import org.vaadin.spring.events.EventBus;
10
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
11 11

  
12 12
import com.vaadin.server.FontAwesome;
13 13
import com.vaadin.server.Resource;
......
41 41
	private Button menuToggle;
42 42

  
43 43
	@Autowired
44
    ApplicationEventPublisher eventBus;
44
    protected EventBus.UIEventBus uiEventBus;
45

  
46
	protected void setUIEventBus(EventBus.UIEventBus uiEventBus){
47
	    this.uiEventBus = uiEventBus;
48
	    uiEventBus.subscribe(this);
49
	}
45 50

  
46 51
	public ValoMainMenuBean() {
47 52
		setPrimaryStyleName(ValoTheme.MENU_ROOT);
......
82 87
	}
83 88

  
84 89
	private void onMenuItemClicked(String navigationResource) {
85
	    eventBus.publishEvent(new NavigationEvent(navigationResource));
90
	    uiEventBus.publish(this, new NavigationEvent(navigationResource));
86 91
	}
87 92

  
88
	@EventListener
93
	@EventBusListenerMethod
89 94
	protected void onNavigationEvent(NavigationEvent e) {
90 95
		List<MainMenuItemBean> menuItems = StreamSupport.stream(menuArea.spliterator(), false)
91 96
				.filter(component -> MainMenuItemBean.class.isAssignableFrom(component.getClass()))
......
99 104
		}
100 105
	}
101 106

  
102
	@EventListener
103
	protected void afterViewChange(AfterViewChangeEvent event) {
107
	@EventBusListenerMethod
108
	protected void afterViewChange(org.vaadin.spring.events.Event<AfterViewChangeEvent> event) {
104 109
		removeStyleName(MENU_VISIBLE);
105 110
	}
106 111

  

Also available in: Unified diff