Class 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 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(new RemoteCallback<MyParams>{
             public void callback(MyParams params) {
               MyMutableGlobal.this.params = params;
               workbench.removeStartupBlocker(MyMutableGlobal.class);
             }
           }).fetchParameters();
         }
       }
     
    • Constructor Detail

      • Workbench

        public Workbench()
    • 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 to addStartupBlocker(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.