Interface PanelManager
-
- All Known Implementing Classes:
PanelManagerImpl
public interface PanelManagerInternal framework component that handles the creation, destruction, layout, and composition (parent-child nesting) of all panels that make up a perspective. Also orchestrates adding and removing parts to/from panels. The outer most workbench panels (header, footer, perspective container) are managed by theWorkbenchLayout.Application code should not invoke any of the methods of this class directly. Doing so will corrupt the state of the PlaceManager, ActivityManager, and potentially other stateful framework components. Applications should always initiate Workbench actions through the public methods on
PlaceManager.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.uberfire.workbench.model.CustomPanelDefinitionaddCustomPanel(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.CustomPanelDefinitionaddCustomPanel(elemental2.dom.HTMLElement container, String panelType)Creates an UberFire panel and installs its view in the given html element container.org.uberfire.workbench.model.CustomPanelDefinitionaddCustomPanel(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.PanelDefinitionaddWorkbenchPanel(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.PanelDefinitionaddWorkbenchPanel(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.voidaddWorkbenchPart(org.uberfire.mvp.PlaceRequest place, org.uberfire.workbench.model.PartDefinition part, org.uberfire.workbench.model.PanelDefinition panel, org.uberfire.workbench.model.menu.Menus menus, UIPart uiPart, String contextId, Integer minInitialWidth, Integer minInitialHeight)Adds the given part to the given panel, which must already be part of the visible workbench layout.voidclosePart(org.uberfire.workbench.model.PartDefinition part)Closes the given part.org.uberfire.workbench.model.PartDefinitiongetFocusedPart()org.uberfire.workbench.model.PanelDefinitiongetPanelForPlace(org.uberfire.mvp.PlaceRequest place)Returns the first PanelDefinition whose place matches the given one.org.uberfire.workbench.model.PanelDefinitiongetRoot()Returns the description of the entire panel + part tree that makes up the UI in its current state.voidonPanelFocus(org.uberfire.workbench.model.PanelDefinition panel)Gives focus to the given panel, if it is known to this PanelManager.voidonPartFocus(org.uberfire.workbench.model.PartDefinition part)voidonPartHidden(org.uberfire.workbench.model.PartDefinition part)voidonPartLostFocus()voidonPartMaximized(org.uberfire.workbench.model.PartDefinition part)voidonPartMinimized(org.uberfire.workbench.model.PartDefinition part)booleanremovePartForPlace(org.uberfire.mvp.PlaceRequest toRemove)Removes the part associated with the given PlaceRequest from the panel that contains it.voidremoveWorkbenchPanel(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.voidsetRoot(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 givenPanelDefinition.
-
-
-
Method Detail
-
getRoot
org.uberfire.workbench.model.PanelDefinition getRoot()
Returns the description of the entire panel + part tree that makes up the UI in its current state.
-
addWorkbenchPart
void addWorkbenchPart(org.uberfire.mvp.PlaceRequest place, org.uberfire.workbench.model.PartDefinition part, org.uberfire.workbench.model.PanelDefinition panel, org.uberfire.workbench.model.menu.Menus menus, UIPart uiPart, String contextId, Integer minInitialWidth, Integer minInitialHeight)Adds the given part to the given panel, which must already be part of the visible workbench layout. Fires aSelectPlaceEventwith the givenPlaceRequestonce the part has been added.- Parameters:
place- The PlaceRequest that the part was resolved from. Not null.part- The description of the part to add. Not null.panel- 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?)minInitialWidth- 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.minInitialHeight- 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.
-
addWorkbenchPanel
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. 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
addWorkbenchPanel(PanelDefinition, PanelDefinition, Position)). candidate for deletion.
-
addWorkbenchPanel
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. Upon successful completion of this method, the child panel will have a new parent panel. ItsPanelDefinition,WorkbenchPanelPresenter, andWorkbenchPanelViewand 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.- Throws:
IllegalStateException- iftargetPanelalready has a child atpositionand it doesn't have any special collision avoidance logicUnsupportedOperationException- iftargetPaneldoesn't support child panels.IllegalArgumentException- iftargetPaneldoesn't understand the givenpositionvalue.
-
addCustomPanel
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.Custom Panel Lifecycle
Custom panels can be disposed like any other panel: by calling
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.- 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
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.Custom Panel Lifecycle
Custom panels can be disposed like any other panel: by calling
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.- 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
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.Custom Panel Lifecycle
Custom panels can be disposed like any other panel: by calling
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.- 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.
-
removeWorkbenchPanel
void removeWorkbenchPanel(org.uberfire.workbench.model.PanelDefinition toRemove) throws IllegalStateExceptionRemoves 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.- Parameters:
toRemove- the panel to remove from the workbench layout. Must not be null.- Throws:
IllegalStateException- if the panel contains parts or child panelsIllegalArgumentException- if no panel presenter is currently associated with the given definition
-
removePartForPlace
boolean removePartForPlace(org.uberfire.mvp.PlaceRequest toRemove)
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.- 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.
-
onPartFocus
void onPartFocus(org.uberfire.workbench.model.PartDefinition part)
-
onPartLostFocus
void onPartLostFocus()
-
onPanelFocus
void onPanelFocus(org.uberfire.workbench.model.PanelDefinition panel)
Gives focus to the given panel, if it is known to this PanelManager. Also removes focus from all other panels associated with this PanelManager.- Parameters:
panel- the panel to give focus to. May be null, in which case all panels will lose focus.
-
closePart
void closePart(org.uberfire.workbench.model.PartDefinition part)
Closes the given part. This is a convenience method for placeManager.closePlace(part.getPlace()).- Parameters:
part- the part to close (remove from the GUI). Must not be null.
-
setRoot
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 givenPanelDefinition. Only installs the root panel; does not build the child panel/part structure recursively.- Parameters:
root- description of the new root panel to install. Must not be null.
-
getPanelForPlace
org.uberfire.workbench.model.PanelDefinition getPanelForPlace(org.uberfire.mvp.PlaceRequest place)
Returns the first PanelDefinition whose place matches the given one.- Returns:
- the definition for the panel servicing the given place, or null if no such part can be found.
-
onPartHidden
void onPartHidden(org.uberfire.workbench.model.PartDefinition part)
- Parameters:
part- that has been hidden
-
onPartMaximized
void onPartMaximized(org.uberfire.workbench.model.PartDefinition part)
- Parameters:
part- the part that has been maximized
-
onPartMinimized
void onPartMinimized(org.uberfire.workbench.model.PartDefinition part)
- Parameters:
part- the part that has been minimized
-
getFocusedPart
org.uberfire.workbench.model.PartDefinition getFocusedPart()
- Returns:
- the focused
PartDefinition
-
-