public class Workbench extends Object
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 AfterInitialization
methods. The
best place to do this is in the PostConstruct
method of an EntryPoint
bean. You would then remove the
startup blocker from within the callback from the server:
@EntryPoint
public 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;
@PostConstruct
private void earlyInit() { workbench.addStartupBlocker(MyMutableGlobal.class); }@AfterInitialization
private void lateInit() { remoteService.call(newRemoteCallback<MyParams>
{ public void callback(MyParams params) { MyMutableGlobal.this.params = params; workbench.removeStartupBlocker(MyMutableGlobal.class); } }).fetchParameters(); } }
Constructor and Description |
---|
Workbench() |
Modifier and Type | Method and Description |
---|---|
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.
|
PerspectiveActivity |
getHomePerspectiveActivity()
Get the home perspective defined at the workbench authorization policy.
|
void |
removeStartupBlocker(Class<?> responsibleParty)
Causes the given responsible party to no longer block workbench initialization.
|
public void addStartupBlocker(Class<?> responsibleParty)
responsibleParty
- any Class object; typically it will be the class making the call to this method.
Must not be null.public void removeStartupBlocker(Class<?> responsibleParty)
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.
responsibleParty
- any Class object that was previously passed to addStartupBlocker(Class)
.
Must not be null.public PerspectiveActivity getHomePerspectiveActivity()
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.
Copyright © 2012–2018 JBoss by Red Hat. All rights reserved.