Information Technology Reference
In-Depth Information
@ApplicationScoped
@WorkbenchPerspective(
identifier = "myCustomPerspective",
isDefault = false)
public class CustomPerspective {
@Perspective
public PerspectiveDefinition getPerspective() {
final PerspectiveDefinition p =
new PerspectiveDefinitionImpl(
PanelType.ROOT_LIST);
p.setTransient(true);
p.setName(getClass().getName());
p.getRoot().addPart(
new PartDefinitionImpl(
new
DefaultPlaceRequest("myParticularScreenID")
)
);
return p;
}
}
The preceding code defines a perspective that will contain our previously defined screen
with the identifier "myParticularScreenID" . The necessary components of a per-
spective are as follows:
@WorkbenchPerspective : This annotation is used to declare that the class
defines a perspective in the application. It has two attributes—one called iden-
tifier that defines a unique name for this perspective and for external referen-
ce by other tools and another called isDefault , which determines whether it
should be opened by default when the workbench loads. Only one default per-
spective is allowed in each workbench.
@Perspective : This annotated method must return an
org.uberfire.workbench.model.PerspectiveDefinition ob-
ject. These objects will allow different layout dispositions to be formed in a tree-
like structure, and they will reference different screens by their identifier using a
PlaceRequest object.
Search WWH ::




Custom Search