Class PanelManagerImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(com.google.gwt.user.client.ui.HasWidgets container, String panelType)
      Creates an UberFire panel and installs its view in the given widget container.
      org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(elemental2.dom.HTMLElement container, String panelType)
      Creates an UberFire panel and installs its view in the given html element container.
      org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(org.jboss.errai.common.client.dom.HTMLElement container, String panelType)
      Creates an UberFire panel and installs its view in the given html element container.
      org.uberfire.workbench.model.PanelDefinition addWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition targetPanel, org.uberfire.workbench.model.PanelDefinition childPanel, org.uberfire.workbench.model.Position position)
      Adds the given child panel to the given target panel at the given position within the target.
      org.uberfire.workbench.model.PanelDefinition addWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition targetPanel, org.uberfire.workbench.model.Position position, Integer height, Integer width, Integer minHeight, Integer minWidth)
      Adds an empty child panel of the target panel's default child type at the given position within the target panel.
      void addWorkbenchPart​(org.uberfire.mvp.PlaceRequest place, org.uberfire.workbench.model.PartDefinition partDef, org.uberfire.workbench.model.PanelDefinition panelDef, org.uberfire.workbench.model.menu.Menus menus, UIPart uiPart, String contextId, Integer preferredWidth, Integer preferredHeight)
      Adds the given part to the given panel, which must already be part of the visible workbench layout.
      void closePart​(org.uberfire.workbench.model.PartDefinition part)
      Closes the given part.
      protected BeanFactory getBeanFactory()  
      org.uberfire.workbench.model.PartDefinition getFocusedPart()  
      org.uberfire.workbench.model.PanelDefinition getPanelForPlace​(org.uberfire.mvp.PlaceRequest place)
      Returns the first PanelDefinition whose place matches the given one.
      protected org.uberfire.workbench.model.PartDefinition getPartForPlace​(org.uberfire.mvp.PlaceRequest place)
      Returns the first live (associated with an active presenter) PartDefinition whose place matches the given one.
      org.uberfire.workbench.model.PanelDefinition getRoot()
      Returns the description of the entire panel + part tree that makes up the UI in its current state.
      void onPanelFocus​(org.uberfire.workbench.model.PanelDefinition panel)
      Gives focus to the given panel, if it is known to this PanelManager.
      void onPartFocus​(org.uberfire.workbench.model.PartDefinition part)  
      void onPartHidden​(org.uberfire.workbench.model.PartDefinition part)  
      void onPartLostFocus()  
      void onPartMaximized​(org.uberfire.workbench.model.PartDefinition part)  
      void onPartMinimized​(org.uberfire.workbench.model.PartDefinition part)  
      protected void removePart​(org.uberfire.workbench.model.PartDefinition part)
      Destroys the presenter bean associated with the given part and removes the part's presenter from the panel presenter that contains it (which in turn removes the part definition from the panel definition and the part view from the panel view).
      boolean removePartForPlace​(org.uberfire.mvp.PlaceRequest toRemove)
      Removes the part associated with the given PlaceRequest from the panel that contains it.
      void removeWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition toRemove)
      Removes the panel associated with the given definition, removing the panel's presenter and view from the workbench, and freeing any resources associated with them.
      void setRoot​(PerspectiveActivity activity, org.uberfire.workbench.model.PanelDefinition root)
      Clears all existing panel structure from the user interface, then installs a new root panel according to the specifications in the given PanelDefinition.
    • Field Detail

      • mapPartDefinitionToPresenter

        protected final Map<org.uberfire.workbench.model.PartDefinition,​WorkbenchPartPresenter> mapPartDefinitionToPresenter
      • mapPanelDefinitionToPresenter

        protected final Map<org.uberfire.workbench.model.PanelDefinition,​WorkbenchPanelPresenter> mapPanelDefinitionToPresenter
      • customPanels

        protected final Map<org.uberfire.workbench.model.PanelDefinition,​com.google.gwt.user.client.ui.HasWidgets> customPanels
        Remembers which HasWidgets contains each existing custom panel. Items are removed from this map when the panels are closed/removed.
      • customPanelsInsideHTMLElements

        protected final Map<org.uberfire.workbench.model.PanelDefinition,​org.jboss.errai.common.client.dom.HTMLElement> customPanelsInsideHTMLElements
        Remembers which HTMLElements contain each existing custom panel. Items are removed from this map when the panels are closed/removed.
      • customPanelsInsideElemental2HTMLElements

        protected final Map<org.uberfire.workbench.model.PanelDefinition,​elemental2.dom.HTMLElement> customPanelsInsideElemental2HTMLElements
        Remembers which Elemental2 HTMLElements contain each existing custom panel. Items are removed from this map when the panels are closed/removed.
      • placeGainFocusEvent

        protected javax.enterprise.event.Event<PlaceGainFocusEvent> placeGainFocusEvent
      • placeLostFocusEvent

        protected javax.enterprise.event.Event<PlaceLostFocusEvent> placeLostFocusEvent
      • panelFocusEvent

        protected javax.enterprise.event.Event<PanelFocusEvent> panelFocusEvent
      • selectPlaceEvent

        protected javax.enterprise.event.Event<SelectPlaceEvent> selectPlaceEvent
      • placeMaximizedEvent

        protected javax.enterprise.event.Event<PlaceMaximizedEvent> placeMaximizedEvent
      • placeMinimizedEvent

        protected javax.enterprise.event.Event<PlaceMinimizedEvent> placeMinimizedEvent
      • placeHiddenEvent

        protected javax.enterprise.event.Event<PlaceHiddenEvent> placeHiddenEvent
      • iocManager

        protected org.jboss.errai.ioc.client.container.SyncBeanManager iocManager
      • placeManager

        protected javax.enterprise.inject.Instance<PlaceManager> placeManager
      • rootPanelDef

        protected org.uberfire.workbench.model.PanelDefinition rootPanelDef
        Description that the current root panel was created from. Presently, this is a mutable data structure and the whole UF framework tries to keep this in sync with the reality (syncing each change from DOM -> Widget -> UberView -> Presenter -> Definition). This may change in the future. See UF-117.
      • activePart

        protected org.uberfire.workbench.model.PartDefinition activePart
    • Constructor Detail

      • PanelManagerImpl

        @Inject
        public PanelManagerImpl​(javax.enterprise.event.Event<PlaceGainFocusEvent> placeGainFocusEvent,
                                javax.enterprise.event.Event<PlaceLostFocusEvent> placeLostFocusEvent,
                                javax.enterprise.event.Event<PanelFocusEvent> panelFocusEvent,
                                javax.enterprise.event.Event<SelectPlaceEvent> selectPlaceEvent,
                                javax.enterprise.event.Event<PlaceMaximizedEvent> placeMaximizedEvent,
                                javax.enterprise.event.Event<PlaceMinimizedEvent> placeMinimizedEventEvent,
                                javax.enterprise.event.Event<PlaceHiddenEvent> placeHiddenEvent,
                                org.jboss.errai.ioc.client.container.SyncBeanManager iocManager,
                                javax.enterprise.inject.Instance<PlaceManager> placeManager,
                                LayoutSelection layoutSelection,
                                BeanFactory beanFactory,
                                org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil elemental2DomUtil)
    • Method Detail

      • getBeanFactory

        protected BeanFactory getBeanFactory()
      • getRoot

        public org.uberfire.workbench.model.PanelDefinition getRoot()
        Description copied from interface: PanelManager
        Returns the description of the entire panel + part tree that makes up the UI in its current state.
        Specified by:
        getRoot in interface PanelManager
      • setRoot

        public void setRoot​(PerspectiveActivity activity,
                            org.uberfire.workbench.model.PanelDefinition root)
        Description copied from interface: PanelManager
        Clears all existing panel structure from the user interface, then installs a new root panel according to the specifications in the given PanelDefinition. Only installs the root panel; does not build the child panel/part structure recursively.
        Specified by:
        setRoot in interface PanelManager
        root - description of the new root panel to install. Must not be null.
      • addWorkbenchPart

        public void addWorkbenchPart​(org.uberfire.mvp.PlaceRequest place,
                                     org.uberfire.workbench.model.PartDefinition partDef,
                                     org.uberfire.workbench.model.PanelDefinition panelDef,
                                     org.uberfire.workbench.model.menu.Menus menus,
                                     UIPart uiPart,
                                     String contextId,
                                     Integer preferredWidth,
                                     Integer preferredHeight)
        Description copied from interface: PanelManager
        Adds the given part to the given panel, which must already be part of the visible workbench layout. Fires a SelectPlaceEvent with the given PlaceRequest once the part has been added.
        Specified by:
        addWorkbenchPart in interface PanelManager
        Parameters:
        place - The PlaceRequest that the part was resolved from. Not null.
        partDef - The description of the part to add. Not null.
        panelDef - definition of the panel to add the part to (must describe a panel that is already present in the layout). Not null.
        menus - The menus to display for the given part. Null means no menus.
        uiPart - The part's title and physical view. Not null.
        contextId - part of a removed framework feature (TODO: remove this?)
        preferredWidth - minimum pixel width of the part's activity, or null if there is no known minimum width. The target panel will expand to the this width if the panel is not already at least as wide, and only if it supports resizing on the horizontal axis.
        preferredHeight - minimum pixel height of the part's activity, or null if there is no known minimum height. The target panel will expand to this height if the panel is not already at least as tall, and only if it supports resizing on the vertical axis.
      • removePartForPlace

        public boolean removePartForPlace​(org.uberfire.mvp.PlaceRequest toRemove)
        Description copied from interface: PanelManager
        Removes the part associated with the given PlaceRequest from the panel that contains it. If this operation removes the last part from the panel, and the panel is not the root panel, it will be removed from the workbench layout. Child panels are preserved by reparenting them to the removed panel's parent. Application code should not call this method directly; it is called by PlaceManager as part of the overall procedure in closing a place.
        Specified by:
        removePartForPlace in interface PanelManager
        Parameters:
        toRemove - the place that is closing. Must not be null.
        Returns:
        true if the associated part was found and removed; false if no matching part could be found.
      • addWorkbenchPanel

        public org.uberfire.workbench.model.PanelDefinition addWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition targetPanel,
                                                                              org.uberfire.workbench.model.Position position,
                                                                              Integer height,
                                                                              Integer width,
                                                                              Integer minHeight,
                                                                              Integer minWidth)
        Description copied from interface: PanelManager
        Adds an empty child panel of the target panel's default child type at the given position within the target panel. The new child panel will have the given dimensions and minimum sizes set on it.

        TODO: the usefulness of this method to callers is questionable (versus creating a new child panel definition and calling PanelManager.addWorkbenchPanel(PanelDefinition, PanelDefinition, Position)). candidate for deletion.

        Specified by:
        addWorkbenchPanel in interface PanelManager
      • removeWorkbenchPanel

        public void removeWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition toRemove)
                                  throws IllegalStateException
        Description copied from interface: PanelManager
        Removes the panel associated with the given definition, removing the panel's presenter and view from the workbench, and freeing any resources associated with them. The panel must have no parts and no child panels.
        Specified by:
        removeWorkbenchPanel in interface PanelManager
        Parameters:
        toRemove - the panel to remove from the workbench layout. Must not be null.
        Throws:
        IllegalStateException - if the panel contains parts or child panels
      • onPartFocus

        public void onPartFocus​(org.uberfire.workbench.model.PartDefinition part)
        Specified by:
        onPartFocus in interface PanelManager
      • onPartMaximized

        public void onPartMaximized​(org.uberfire.workbench.model.PartDefinition part)
        Specified by:
        onPartMaximized in interface PanelManager
        Parameters:
        part - the part that has been maximized
      • onPartMinimized

        public void onPartMinimized​(org.uberfire.workbench.model.PartDefinition part)
        Specified by:
        onPartMinimized in interface PanelManager
        Parameters:
        part - the part that has been minimized
      • getFocusedPart

        public org.uberfire.workbench.model.PartDefinition getFocusedPart()
        Specified by:
        getFocusedPart in interface PanelManager
        Returns:
        the focused PartDefinition
      • onPartHidden

        public void onPartHidden​(org.uberfire.workbench.model.PartDefinition part)
        Specified by:
        onPartHidden in interface PanelManager
        Parameters:
        part - that has been hidden
      • onPanelFocus

        public void onPanelFocus​(org.uberfire.workbench.model.PanelDefinition panel)
        Description copied from interface: PanelManager
        Gives focus to the given panel, if it is known to this PanelManager. Also removes focus from all other panels associated with this PanelManager.
        Specified by:
        onPanelFocus in interface PanelManager
        Parameters:
        panel - the panel to give focus to. May be null, in which case all panels will lose focus.
      • closePart

        public void closePart​(org.uberfire.workbench.model.PartDefinition part)
        Description copied from interface: PanelManager
        Closes the given part. This is a convenience method for placeManager.closePlace(part.getPlace()).
        Specified by:
        closePart in interface PanelManager
        Parameters:
        part - the part to close (remove from the GUI). Must not be null.
      • getPanelForPlace

        public org.uberfire.workbench.model.PanelDefinition getPanelForPlace​(org.uberfire.mvp.PlaceRequest place)
        Description copied from interface: PanelManager
        Returns the first PanelDefinition whose place matches the given one.
        Specified by:
        getPanelForPlace in interface PanelManager
        Returns:
        the definition for the panel servicing the given place, or null if no such part can be found.
      • getPartForPlace

        protected org.uberfire.workbench.model.PartDefinition getPartForPlace​(org.uberfire.mvp.PlaceRequest place)
        Returns the first live (associated with an active presenter) PartDefinition whose place matches the given one.
        Returns:
        the definition for the live part servicing the given place, or null if no such part can be found.
      • removePart

        protected void removePart​(org.uberfire.workbench.model.PartDefinition part)
        Destroys the presenter bean associated with the given part and removes the part's presenter from the panel presenter that contains it (which in turn removes the part definition from the panel definition and the part view from the panel view).
        Parameters:
        part - the definition of the workbench part (screen or editor) to remove from the layout.
      • addWorkbenchPanel

        public org.uberfire.workbench.model.PanelDefinition addWorkbenchPanel​(org.uberfire.workbench.model.PanelDefinition targetPanel,
                                                                              org.uberfire.workbench.model.PanelDefinition childPanel,
                                                                              org.uberfire.workbench.model.Position position)
        Description copied from interface: PanelManager
        Adds the given child panel to the given target panel at the given position within the target. Upon successful completion of this method, the child panel will have a new parent panel. Its PanelDefinition, WorkbenchPanelPresenter, and WorkbenchPanelView and those of its new parent will be updated to reflect the new relationship. Note that the given target panel will not necessarily be the new parent: panel implementations may choose to avoid collisions (more than one child panel in the same position) by redirecting requests to add children.
        Specified by:
        addWorkbenchPanel in interface PanelManager
      • addCustomPanel

        public org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(com.google.gwt.user.client.ui.HasWidgets container,
                                                                                 String panelType)
        Description copied from interface: PanelManager
        Creates an UberFire panel and installs its view in the given widget container.

        Custom Panel Lifecycle

        Custom panels can be disposed like any other panel: by calling PanelManager.removeWorkbenchPanel(PanelDefinition). Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then the associated panel is disposed.

        Specified by:
        addCustomPanel in interface PanelManager
        Parameters:
        container - the widget container to install the new panel in. The new panel will fill the container.
        Returns:
        the definition for the newly constructed panel. Never null. The panel's type will be panelType; its parent will be null; isRoot() will return false.
      • addCustomPanel

        public org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(org.jboss.errai.common.client.dom.HTMLElement container,
                                                                                 String panelType)
        Description copied from interface: PanelManager
        Creates an UberFire panel and installs its view in the given html element container.

        Custom Panel Lifecycle

        Custom panels can be disposed like any other panel: by calling PanelManager.removeWorkbenchPanel(PanelDefinition). Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then the associated panel is disposed.

        Specified by:
        addCustomPanel in interface PanelManager
        Parameters:
        container - the html element container to install the new panel in. The new panel will fill the container.
        Returns:
        the definition for the newly constructed panel. Never null. The panel's type will be panelType; its parent will be null; isRoot() will return false.
      • addCustomPanel

        public org.uberfire.workbench.model.CustomPanelDefinition addCustomPanel​(elemental2.dom.HTMLElement container,
                                                                                 String panelType)
        Description copied from interface: PanelManager
        Creates an UberFire panel and installs its view in the given html element container.

        Custom Panel Lifecycle

        Custom panels can be disposed like any other panel: by calling PanelManager.removeWorkbenchPanel(PanelDefinition). Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then the associated panel is disposed.

        Specified by:
        addCustomPanel in interface PanelManager
        Parameters:
        container - the html element container to install the new panel in. The new panel will fill the container.
        Returns:
        the definition for the newly constructed panel. Never null. The panel's type will be panelType; its parent will be null; isRoot() will return false.