Interface WorkbenchPanelView<P extends WorkbenchPanelPresenter>
-
- All Superinterfaces:
org.uberfire.client.mvp.HasPresenter<P>,com.google.gwt.user.client.ui.IsWidget,com.google.gwt.user.client.ui.RequiresResize,org.uberfire.client.mvp.UberView<P>
- All Known Subinterfaces:
DockingWorkbenchPanelView<P>
- All Known Implementing Classes:
AbstractDockingWorkbenchPanelView,AbstractMultiPartWorkbenchPanelView,AbstractSimpleWorkbenchPanelView,AbstractWorkbenchPanelView,AdaptiveWorkbenchPanelView,ClosableSimpleWorkbenchPanelView,ImmutableWorkbenchPanelView,LayoutPanelView,MultiListWorkbenchPanelView,MultiScreenWorkbenchPanelView,SimpleDnDWorkbenchPanelView,SimpleNoExpandWorkbenchPanelView,SimpleWorkbenchPanelView,SplitLayoutPanelView,StaticWorkbenchPanelView,TemplatedWorkbenchPanelView,UnanchoredStaticWorkbenchPanelView
public interface WorkbenchPanelView<P extends WorkbenchPanelPresenter> extends org.uberfire.client.mvp.UberView<P>, com.google.gwt.user.client.ui.RequiresResizeManages the Widget and DOM interaction of a panel. Part of the UberFire MVC system for panels. For a full explanation of what a panel is in UberFire, see the class-level documentation forWorkbenchPanelPresenter.View Lifecycle
UberFire Panel Views are Dependent-scoped beans managed by the Errai IOC container. Views are always created by injection into their presenter, which ties their bean lifecycle to that of the presenter: they are created when the presenter is created, and they are destroyed when the presenter is destroyed.
This is the lifecycle of a WorkbenchPanelView:
- The view's constructor is invoked by Errai IOC. At this point, it is not yet safe to access injected members (they may be uninitialized proxies).
- The view's
@PostConstructmethod (if it has one) is invoked by Errai IOC. Safe to access injected members. - The view's
HasPresenter.init(Object)method is invoked by the presenter. The argument is a reference to the presenter itself. - The view's widget (obtained from
IsWidget.asWidget()) is added to the parent panel's widget. - The view is now in service, and any of its public methods can be called.
- When the panel is no longer needed, Errai IOC is told to destroy the presenter bean. This results in the view bean
being destroyed too. At this point, the view's
@PreDestroymethod is invoked by Errai IOC.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddPanel(org.uberfire.workbench.model.PanelDefinition panel, WorkbenchPanelView<?> view, org.uberfire.workbench.model.Position position)Nests the given WorkbenchPanelView inside this one at the given position, which must be unoccupied.voidaddPart(WorkbenchPartPresenter.View view)Adds the given part view to this panel if this panel does not already contain a view that handles the samePlaceRequestas the given one.voidchangeTitle(org.uberfire.workbench.model.PartDefinition part, String title, com.google.gwt.user.client.ui.IsWidget titleDecoration)Assigns the given title to the given part, if the part belongs to this panel.com.google.gwt.user.client.ui.WidgetgetPartDropRegion()Returns the widget that defines the boundaries of this panel view for purposes of drag-and-drop.Collection<org.uberfire.workbench.model.PartDefinition>getParts()Returns the parts currently held by the view.PgetPresenter()Returns this view's presenter.voidmaximize()Maximizes this view usingWorkbenchLayout.maximize(Widget).booleanremovePanel(WorkbenchPanelView<?> child)Removes the view widget associated with the given child from this panel, freeing any resources that were allocated by this panel when the child was added.booleanremovePart(org.uberfire.workbench.model.PartDefinition part)Removes the given part from this view, if it belonged to this view.booleanselectPart(org.uberfire.workbench.model.PartDefinition part)Makes the given part visible and focused, if it belongs to this view.voidsetElementId(String elementId)Sets the ID of the physical root element of this view.voidsetFocus(boolean hasFocus)Informs this view that it has gained or lost keyboard focus.voidunmaximize()Restores this view to its original unmaximized size and position usingWorkbenchLayout.unmaximize(Widget).
-
-
-
Method Detail
-
getPresenter
P getPresenter()
Returns this view's presenter.- Returns:
- the presenter that this view is bound to. Will return null if invoked before the presenter calls
HasPresenter.init(Object); afterward, the return value is never null.
-
addPart
void addPart(WorkbenchPartPresenter.View view)
Adds the given part view to this panel if this panel does not already contain a view that handles the samePlaceRequestas the given one. If this panel does already contain such a part, the existing one isselectedand the given one is not added.- Parameters:
view- the view to add as long as it is not a duplicate. Must not be null.
-
addPanel
void addPanel(org.uberfire.workbench.model.PanelDefinition panel, WorkbenchPanelView<?> view, org.uberfire.workbench.model.Position position)Nests the given WorkbenchPanelView inside this one at the given position, which must be unoccupied. This is an optional feature of WorkbenchPanelView: not all implementations support nested child panels. Additionally, different panels support differentPositiontypes. Implementations should document whether or not they support child panels, and if so, what types of Positions they understand.- Parameters:
panel- specifies the size that should be imposed on the nested view. Must not be null. FIXME: is this sensible/correct?view- the panel to nest inside this one. Must not be null.position- specifies which edge of this panel will be shared with the nested panel. Must not be null.- Throws:
IllegalStateException- if the given position is already occupied by a child panel.IllegalArgumentException- if the given child position is not understood by this type of panel.UnsupportedOperationException- if this panel does not support child panels at all.
-
removePanel
boolean removePanel(WorkbenchPanelView<?> child)
Removes the view widget associated with the given child from this panel, freeing any resources that were allocated by this panel when the child was added.
-
changeTitle
void changeTitle(org.uberfire.workbench.model.PartDefinition part, String title, com.google.gwt.user.client.ui.IsWidget titleDecoration)Assigns the given title to the given part, if the part belongs to this panel.- Parameters:
part- the part whose title to change. Must not be null.title- the new title. Must not be null.titleDecoration- An optional widget to display beside the title. Note that some implementations do not support title decorations, and they will ignore this. Null is permitted, and means no decoration.
-
selectPart
boolean selectPart(org.uberfire.workbench.model.PartDefinition part)
Makes the given part visible and focused, if it belongs to this view.- Parameters:
part- the part to reveal and give focus to.- Returns:
- true if the part was found, made visible, and given focus. False if not.
-
removePart
boolean removePart(org.uberfire.workbench.model.PartDefinition part)
Removes the given part from this view, if it belonged to this view.- Parameters:
part- the part to remove.- Returns:
- true if the part was found and removed. False if not.
-
setFocus
void setFocus(boolean hasFocus)
Informs this view that it has gained or lost keyboard focus. Focused views may respond by updating their style to look more prominent than unfocused views.- Parameters:
hasFocus- if true, this panel now has focus. If false, this panel does not have focus.
-
setElementId
void setElementId(String elementId)
Sets the ID of the physical root element of this view. For HTML-based views, this is theidattribute of the view's top-level DOM element. Implementations for other view technologies should map this to whatever the underlying widget/component system uses for unique identifiers.- Parameters:
elementId- the element ID to set. If null, the ID value will be cleared.
-
getPartDropRegion
com.google.gwt.user.client.ui.Widget getPartDropRegion()
Returns the widget that defines the boundaries of this panel view for purposes of drag-and-drop.- Returns:
- the widget whose boundaries define the region where workbench parts can be dropped into this panel. For
simple panel types that do not support child panels, this will typically be the same widget returned by
IsWidget.asWidget(). For fancier panels, this will typically be some child panel within the view's internal structure.If the return value is null, parts will not be droppable on this view.
-
maximize
void maximize()
Maximizes this view usingWorkbenchLayout.maximize(Widget).
-
unmaximize
void unmaximize()
Restores this view to its original unmaximized size and position usingWorkbenchLayout.unmaximize(Widget).
-
getParts
Collection<org.uberfire.workbench.model.PartDefinition> getParts()
Returns the parts currently held by the view.
-
-