Тёмный

Event Bus: GWT Tutorial (Google Web Toolkit) 

Easy Learn Tutorial
Подписаться 18 тыс.
Просмотров 17 тыс.
50% 1

Why use an event bus: allow components to communicate throughout the app in a decoupled way.
This Google Web Toolkit tutorial explains the event bus pattern. Behind the scenes, if you squint your eyes, you can see the subscriber, pub/sub design pattern going on. The purpose and goal of the event bus is to decouple your application, and allow for inter-component communication. Instead, for example, of having some widget take a reference to some other widget, and manually modify that widget when it needs to (perhaps as a result of some user interaction), we could instead use the GWTEvent class to fire or broadcast an event saying that said user interaction has taken place somewhere. Then, any widgets, components, modules, views, presenters, etc., that would like to take action as a result, will be notified about it, and will be allowed to do their thing.
The example in the tutorial users a button, whose click handler fires the event (a Decline event). There is a label widget that wants to know when the button is clicked, so it registers a Decline handler with the event bus. Whenever that event is fired, the label can update itself, according to the business logic that it follows.
The steps to using an event bus are simple:
#1. Create an event - some class that extends GwtEvent, and is typed with the event handler associated with it. Unfortunately, there are some boilerplate code in this class that is tedious, but is not a big deal.
#2. Create an event handler - some interface that extends EventHandler. Here you can define the methods that a handler for the event can/must implement.
#3 Instantiate an event bus - either create your own event bus by extending Event, or use one of the ready, out of the box kinds. Using SimpleEventBus is fine for most cases.
#4 Pass the event bus object around so anyone can register events on it, as well as tell it to fire events as they occur.
Programming tutorials by Easy Learn Tutorial - because anyone can learn how to become an expert software and web developer!
Copyright (c) 2013 Rodrigo Silveira - www.easylearntutorial.com

Опубликовано:

 

30 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 23   
@rajkannanIyyappan
@rajkannanIyyappan 8 лет назад
Excellent tutorials! Very well organized and straight to the point. Thank you.
@rachelvictoriaweber56
@rachelvictoriaweber56 7 лет назад
May we please have a tutorial on how to create custom widgets and insert them into views/displays?
@rachelvictoriaweber56
@rachelvictoriaweber56 7 лет назад
Thanks for all the GWT tutorials! :D
@moofymoo
@moofymoo 10 лет назад
good series, lookin' forward for next video. suggestion for next- testing and how to organize and maintain larger projects, like some sort of dashboard with multiple lists, charts, forms, etc.
@the_derpler
@the_derpler 8 лет назад
This was very helpful. Thank you.
@gaspardzhou2859
@gaspardzhou2859 9 лет назад
Thank you for all!!!
@sebasvelez
@sebasvelez 10 лет назад
Thank you! this videos are great, they help me to change my previous boring job to a better one (y)
@wangjenny9624
@wangjenny9624 10 лет назад
Hope it could help me to get one too:)
@Scott-ko6vi
@Scott-ko6vi 9 лет назад
I totally thought you were talking about sharks, like the animal in the water ... hahah. I haven't seen that show, but I think I get the gist of it, hah
@vivekpatel3875
@vivekpatel3875 8 лет назад
This Was good Video Easily understand concept of Eventbus So thank U So much.......
@manikantakorata
@manikantakorata 10 лет назад
nice videos......very instructive....Thanks...and waiting for next tutorials.. :)
@SEDHURAJANALLAYAN
@SEDHURAJANALLAYAN 10 лет назад
Hey I watched all the 14 videos. Its is informative. I suggest in next videos pls talk about REQUEST FACTORY, CLIENT BUNDLE, I18N, MULTIPLE MODULES, MULTIPLE ENTRY POINTS, TESTING GWT, HISTORY MANAGEMENT
@easylearntutorial
@easylearntutorial 10 лет назад
Love it! I'll probably talk about I18N next, since that can be thoroughly explained in a singe ~10 minute video. Probably following it up with history management (also pretty simple for a single video). Other than that, I think the order you mentioned them is pretty good as is. Thanks for the suggestions.
@user-wc9ll2uo6h
@user-wc9ll2uo6h 7 лет назад
helpful , thx!
@paddytb
@paddytb 10 лет назад
Thanks!
@Jeslinedias
@Jeslinedias 10 лет назад
Hi, Uberfire is totally build over GWT. Do you have any plans of giving a tutorial on Uberfire ?
@mguven
@mguven 9 лет назад
I'm so sorry but need to ask something that why instead of doing this I dont create a method which collect the whole related common logics into 1 place such as setBackgroundColor() (in this particular case I would call a method named iAmOut() instead of creating eventhandler) and call it by the listener? I mean I really dont understand its servicableness here.
@123494656
@123494656 10 лет назад
very nice tut. More GWT tutorials coming ?) thx
@easylearntutorial
@easylearntutorial 10 лет назад
I'm trying to get more video done, trust me. Wish someone had told me how much how much of one's time is taken up by a 6 month old - plus a pregnant wife =)
@afy44
@afy44 10 лет назад
Easy Learn Tutorial Congrats ! Nice work overall, just wanted to butt that in =)
@123494656
@123494656 10 лет назад
GWT and MVP a very interesting thing. But looks like I stuck. Everything related to the tutorial is ok. But I created 2 presenters and a view. They work fune through appController. But how to pass data from View1 to View2 , Presenter1 to Presenter2 and viceVersa I know is not directly related to your tutorial but it will help me to understand . THX
@Waldi_WK
@Waldi_WK 10 лет назад
Read about history events handlling in www.gwtproject.org/articles/mvp-architecture.html.
@Miconeable1
@Miconeable1 2 года назад
no
Далее
I've been using Redis wrong this whole time...
20:53
Просмотров 344 тыс.
Google I/O 2013 - Demystifying MVP and EventBus in GWT
42:43
The moment we stopped understanding AI [AlexNet]
17:38
Просмотров 807 тыс.
Protocols and Tools for Testing Web Apps
16:48
Просмотров 4,1 тыс.
Hello World - GWT Tutorial (Google Web Toolkit)
19:50
Google Data Center 360° Tour
8:29
Просмотров 5 млн