Information Technology Reference
In-Depth Information
Creating a screen and a pop up
Now that we have seen all the UberFire annotation components, we can start seeing in de-
tail the components created in the uberfire-demo project provided with the topic.
In our example, we create a user interface to show a very simple functionality; a screen that
shows us a list of messages with a pop up that allows us to create a new message. Messages
are stored as simple String elements. The project is divided into three subprojects:
uberfire-demo-api : This subproject defines a service interface for reading all mes-
sages and adding a new one (called DemoServiceEntryPoint ) and an event
type for sending a new message back and forth (called NewMessageEvent ).
You can see in the code that the event class is marked with the @Portable an-
notation, to make it accessible through both Java and GWT JavaScript code. Also,
the service interface is marked with the @Remote annotation, which lets Errai
know that the GWT code will try to invoke it.
uberfire-demo-backend : This subproject defines an implementation for the ser-
vice interface defined in the uberfire-demo-api project. The implementation
is based on holding a list in memory and adding values to it. What's really interest-
ing about it is that it's marked with a @Service annotation that lets Errai know
this is an implementation for an Errai server-side service.
uberfire-demo-client : This subproject defines the user interfaces. Here's where we
will use most of the UberFire components previously explained.
For this example, uberfire-demo-client is the subproject that will be most useful
for us. We have created two components in it, a screen (to display a message list) and a
popup (to create a new message). Let's take a look at specific utilities that the Message List
screen uses by looking at a code fragment of MessageListPresenter :
@Dependent
@WorkbenchScreen(identifier =
"uberFireDemo.MessageListScreen")
public class MessageListPresenter {
public interface MessageListView extends
UberView<MessageListPresenter> {
void displayNotification(String text);
DataGrid<String> getDataGrid();
}
@Inject
Search WWH ::




Custom Search