Class Workbench
- java.lang.Object
-
- org.uberfire.client.workbench.Workbench
-
public class Workbench extends Object
Responsible for bootstrapping the client-side Workbench user interface by coordinating calls to the PanelManager and PlaceManager. Normally this happens automatically with no need for assistance or interference from the application. Thus, applications don't usually need to do anything with the Workbench class directly.Delaying Workbench Startup
In special cases, applications may wish to delay the startup of the workbench. For example, an application that relies on global variables (also known as singletons or Application Scoped beans) that are initialized based on response data from the server doesn't want UberFire to start initializing its widgets until that server response has come in.
To delay startup, add a Startup Blocker before Errai starts calling
AfterInitializationmethods. The best place to do this is in thePostConstructmethod of anEntryPointbean. You would then remove the startup blocker from within the callback from the server:@EntryPointpublic class MyMutableGlobal() {@Inject private Workbench workbench;@Inject private Caller<MyRemoteService> remoteService;// set up by a server call. don't start the app until it's populated!private MyParams params;@PostConstructprivate void earlyInit() { workbench.addStartupBlocker(MyMutableGlobal.class); }@AfterInitializationprivate void lateInit() { remoteService.call(newRemoteCallback<MyParams>{ public void callback(MyParams params) { MyMutableGlobal.this.params = params; workbench.removeStartupBlocker(MyMutableGlobal.class); } }).fetchParameters(); } }
-
-
Constructor Summary
Constructors Constructor Description Workbench()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStartupBlocker(Class<?> responsibleParty)Requests that the workbench does not attempt to create any UI parts until the given responsible party has been removed as a startup blocker.PerspectiveActivitygetHomePerspectiveActivity()Get the home perspective defined at the workbench authorization policy.voidremoveStartupBlocker(Class<?> responsibleParty)Causes the given responsible party to no longer block workbench initialization.
-
-
-
Method Detail
-
addStartupBlocker
public void addStartupBlocker(Class<?> responsibleParty)
Requests that the workbench does not attempt to create any UI parts until the given responsible party has been removed as a startup blocker. Blockers are tracked as a set, so adding the same class more than once has no effect.- Parameters:
responsibleParty- any Class object; typically it will be the class making the call to this method. Must not be null.
-
removeStartupBlocker
public void removeStartupBlocker(Class<?> responsibleParty)
Causes the given responsible party to no longer block workbench initialization. If the given responsible party was not already in the blocking set (either because it was never added, or it has already been removed) then the method call has no effect.After removing the blocker, if there are no more blockers left in the blocking set, the workbench UI is bootstrapped immediately. If there are still one or more blockers left in the blocking set, the workbench UI remains uninitialized.
- Parameters:
responsibleParty- any Class object that was previously passed toaddStartupBlocker(Class). Must not be null.
-
getHomePerspectiveActivity
public PerspectiveActivity getHomePerspectiveActivity()
Get the home perspective defined at the workbench authorization policy.If no home is defined then the perspective marked as "
isDefault=true" is taken.Notice that access permission over the selected perspective is always required.
- Returns:
- A perspective instance or null if no perspective is found or access to it has been denied.
-
-