Information Technology Reference
In-Depth Information
@WorkbenchEditor(identifier = "myEditorForTypeX",
supportedTypes = { XClientType.class })
public class MyEditor {
@WorkbenchPartTitle
public String getTitle() {
return "MyEditor";
}
@WorkbenchPartView
public IsWidget getEditorView() {
…
}
@OnStartup
public void onStart(final Path path) {
…
}
…
}
In the preceding code, there are a few things that are different from workbench screens:
•
@WorkbenchEditor
: This annotation is used to declare that the class defines
an editor in the application. It has two attributes—one called
identifier
that
defines a unique name for this editor and for external reference by other tools and
another called
supportedTypes
, which should receive an array of all file
types that the editor can work with. File types are represented using the
org.uberfire.client.workbench.type.ClientResourceType
class that can be extended to add support for new file types.
•
@OnStartup
: This is one of UberFire's lifecycle annotations. They are better
explained in the next subsection. It marks a method that will be called when the
editor is created. For the special case of editors, the annotated method can receive
a parameter of type
org.uberfire.backend.vfs.Path
, which denotes
the file with which the editor will be working.
Workbench perspectives
UberFire workbench UI components are arranged as
Workbench
|
Perspective
|
Panel
|
Workbench
screen. Perspectives dictate the position and size of workbench panels, and
therefore provide a place to put our workbench screens and editors. Defining a perspective
is very simple: