Class TemplatedWorkbenchPanelView
- java.lang.Object
-
- org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelView
-
- All Implemented Interfaces:
com.google.gwt.user.client.ui.IsWidget,com.google.gwt.user.client.ui.RequiresResize,org.uberfire.client.mvp.HasPresenter<TemplatedWorkbenchPanelPresenter>,org.uberfire.client.mvp.UberView<TemplatedWorkbenchPanelPresenter>,WorkbenchPanelView<TemplatedWorkbenchPanelPresenter>
@Dependent @Named("TemplatedWorkbenchPanelView") public class TemplatedWorkbenchPanelView extends Object implements WorkbenchPanelView<TemplatedWorkbenchPanelPresenter>The view component of the templated panel system. This view supports an arbitrary number of child panel views, each identified by aNamedPosition.This view does not support having parts added to it directly, so it also does not support drag-and-drop of parts.
- See Also:
TemplatedWorkbenchPanelPresenter,WorkbenchPanel
-
-
Constructor Summary
Constructors Constructor Description TemplatedWorkbenchPanelView()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPanel(org.uberfire.workbench.model.PanelDefinition panel, WorkbenchPanelView<?> view, org.uberfire.workbench.model.Position p)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.com.google.gwt.user.client.ui.WidgetasWidget()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.TemplatedWorkbenchPanelPresentergetPresenter()Returns this view's presenter.voidinit(TemplatedWorkbenchPanelPresenter presenter)voidmaximize()Maximizes this view usingWorkbenchLayout.maximize(Widget).voidonResize()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.voidsetActivity(TemplatedActivity activity)voidsetElementId(String elementId)Will set, but not clear, the ID of the activity's root element.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
-
init
public void init(TemplatedWorkbenchPanelPresenter presenter)
- Specified by:
initin interfaceorg.uberfire.client.mvp.HasPresenter<TemplatedWorkbenchPanelPresenter>
-
setActivity
public void setActivity(TemplatedActivity activity)
-
asWidget
public com.google.gwt.user.client.ui.Widget asWidget()
- Specified by:
asWidgetin interfacecom.google.gwt.user.client.ui.IsWidget
-
onResize
public void onResize()
- Specified by:
onResizein interfacecom.google.gwt.user.client.ui.RequiresResize
-
getPresenter
public TemplatedWorkbenchPanelPresenter getPresenter()
Description copied from interface:WorkbenchPanelViewReturns this view's presenter.- Specified by:
getPresenterin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- 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.
-
addPanel
public void addPanel(org.uberfire.workbench.model.PanelDefinition panel, WorkbenchPanelView<?> view, org.uberfire.workbench.model.Position p)Description copied from interface:WorkbenchPanelViewNests 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.- Specified by:
addPanelin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- 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.p- specifies which edge of this panel will be shared with the nested panel. Must not be null.
-
removePanel
public boolean removePanel(WorkbenchPanelView<?> child)
Description copied from interface:WorkbenchPanelViewRemoves 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.- Specified by:
removePanelin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>
-
setFocus
public void setFocus(boolean hasFocus)
Description copied from interface:WorkbenchPanelViewInforms 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.- Specified by:
setFocusin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- Parameters:
hasFocus- if true, this panel now has focus. If false, this panel does not have focus.
-
addPart
public void addPart(WorkbenchPartPresenter.View view)
Description copied from interface:WorkbenchPanelViewAdds 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.- Specified by:
addPartin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- Parameters:
view- the view to add as long as it is not a duplicate. Must not be null.
-
getParts
public Collection<org.uberfire.workbench.model.PartDefinition> getParts()
Description copied from interface:WorkbenchPanelViewReturns the parts currently held by the view.- Specified by:
getPartsin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>
-
changeTitle
public void changeTitle(org.uberfire.workbench.model.PartDefinition part, String title, com.google.gwt.user.client.ui.IsWidget titleDecoration)Description copied from interface:WorkbenchPanelViewAssigns the given title to the given part, if the part belongs to this panel.- Specified by:
changeTitlein interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- 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
public boolean selectPart(org.uberfire.workbench.model.PartDefinition part)
Description copied from interface:WorkbenchPanelViewMakes the given part visible and focused, if it belongs to this view.- Specified by:
selectPartin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- 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
public boolean removePart(org.uberfire.workbench.model.PartDefinition part)
Description copied from interface:WorkbenchPanelViewRemoves the given part from this view, if it belonged to this view.- Specified by:
removePartin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- Parameters:
part- the part to remove.- Returns:
- true if the part was found and removed. False if not.
-
getPartDropRegion
public com.google.gwt.user.client.ui.Widget getPartDropRegion()
Description copied from interface:WorkbenchPanelViewReturns the widget that defines the boundaries of this panel view for purposes of drag-and-drop.- Specified by:
getPartDropRegionin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- 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.
-
setElementId
public void setElementId(String elementId)
Will set, but not clear, the ID of the activity's root element. Clearing is disabled because the templating system may be relying on the element's ID to find it. Of course, setting a different ID will also interfere with templating, but the expectation is that this feature would only be used with templated panels for debugging purposes.- Specified by:
setElementIdin interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>- Parameters:
elementId- the element ID to set. If null, the ID value will be cleared.
-
maximize
public void maximize()
Description copied from interface:WorkbenchPanelViewMaximizes this view usingWorkbenchLayout.maximize(Widget).- Specified by:
maximizein interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>
-
unmaximize
public void unmaximize()
Description copied from interface:WorkbenchPanelViewRestores this view to its original unmaximized size and position usingWorkbenchLayout.unmaximize(Widget).- Specified by:
unmaximizein interfaceWorkbenchPanelView<TemplatedWorkbenchPanelPresenter>
-
-