Information Technology Reference
In-Depth Information
}
@WorkbenchMenu
public WorkbenchMenuBar getBar() {
}
}
There is a lot to comment about the annotations used in the preceding code fragment. Let's
analyze them briefly:
@Dependent : This annotation is not part of UberFire API, but a part of CDI.
CDI marks this class as a dependent scoped CDI bean that should be freshly in-
stantiated every time a new instance is called for. This annotation is in contrast
with @ApplicationScoped , which marks a CDI bean that should be created
only one time over the life of the application.
@WorkbenchScreen : This annotation is used to declare that the class defines a
screen in the application. It has one attribute called identifier that defines a
unique name for this screen, which is used later for external reference by other
components.
@WorkbenchPartTitle : This annotation denotes the method that returns the
screen's title. Every screen must have a @WorkbenchPartTitle method.
@WorkbenchPartView : This annotation denotes the method that returns the
panel's view. The view can be any class that extends GWT's Widget class or im-
plements GWT's IsWidget interface (a basic interface to refer to a UI compon-
ent built in GWT). Every screen must have an @WorkbenchPartView meth-
od.
@WorkbenchMenu : This is an optional annotation to mark a method that will
return a menu for the specific screen. It helps to make all menus in all screens ap-
pear in a similar fashion. The returned type of the annotated method should be an
instance of the
org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar
class.
Using these annotations, we can define different components in any part of the code,
without the need to depend on specific aggregations or class hierarchies and still add new
screens in an easy way.
Search WWH ::




Custom Search