public abstract class AbstractWorkbenchPanelPresenter<P extends AbstractWorkbenchPanelPresenter<P>> extends Object implements WorkbenchPanelPresenter
At the least, concrete subclasses have to implement asPresenterType() to return this. Subclasses may
override other methods as necessary to customize behaviour for use with specialized layouts and view implementations.
| Modifier and Type | Field and Description |
|---|---|
protected Map<Position,WorkbenchPanelPresenter> |
childPanels |
protected PerspectiveManager |
perspectiveManager |
| Constructor and Description |
|---|
AbstractWorkbenchPanelPresenter(WorkbenchPanelView<P> view,
PerspectiveManager perspectiveManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPanel(WorkbenchPanelPresenter child,
Position position)
This base implementation should be sufficient for most panels.
|
void |
addPart(WorkbenchPartPresenter part)
|
void |
addPart(WorkbenchPartPresenter part,
String contextId)
Adds the given part to the view returned by
getPanelView(), ignoring the given contextId. |
protected abstract P |
asPresenterType()
Returns a reference to
this. |
void |
changeTitle(PartDefinition part,
String title,
com.google.gwt.user.client.ui.IsWidget titleDecorator) |
String |
getDefaultChildType()
Most panel types are their own default child type, so this implementation returns
getClass().getName(). |
PanelDefinition |
getDefinition()
Returns a
@Portable description of the current state of this panel. |
Map<Position,WorkbenchPanelPresenter> |
getPanels()
Returns the immediate child panels of this panel.
|
WorkbenchPanelView<P> |
getPanelView()
Returns the view that was given to this panel when it was first created.
|
WorkbenchPanelPresenter |
getParent()
Returns the current parent of this panel presenter.
|
Class<? extends WorkbenchPartPresenter> |
getPartType()
Returns the type of new parts.
|
void |
maximize()
Makes this panel's view take up most of the space on the workbench.
|
void |
onResize(int width,
int height) |
protected Position |
positionOf(WorkbenchPanelPresenter child) |
boolean |
removePanel(WorkbenchPanelPresenter child)
Removes the given panel presenter and its view from this panel, freeing all resources associated with them.
|
boolean |
removePart(PartDefinition part)
Removes the given part from this panel, updating this panel's definition and the part's definition to reflect
that the part no longer belongs to this panel.
|
boolean |
selectPart(PartDefinition part) |
void |
setDefinition(PanelDefinition definition)
Called by the framework when the panel instance is first created.
|
void |
setFocus(boolean hasFocus) |
void |
setParent(WorkbenchPanelPresenter parent)
Sets the current parent of this panel presenter.
|
String |
toString() |
void |
unmaximize()
Restores this panel's view to its original unmaximized size and position.
|
protected final PerspectiveManager perspectiveManager
protected final Map<Position,WorkbenchPanelPresenter> childPanels
public AbstractWorkbenchPanelPresenter(WorkbenchPanelView<P> view, PerspectiveManager perspectiveManager)
protected abstract P asPresenterType()
this. Helps superclass code work around generic type checking problems.public WorkbenchPanelPresenter getParent()
WorkbenchPanelPresentergetParent in interface WorkbenchPanelPresenterpublic void setParent(WorkbenchPanelPresenter parent)
WorkbenchPanelPresentersetParent in interface WorkbenchPanelPresenterparent - the new parent of this panel. If this panel is being removed, the parent should be set to null.public PanelDefinition getDefinition()
WorkbenchPanelPresenter@Portable description of the current state of this panel.getDefinition in interface WorkbenchPanelPresenterpublic void setDefinition(PanelDefinition definition)
WorkbenchPanelPresentersetDefinition in interface WorkbenchPanelPresenterdefinition - description of the state this panel should put itself in. This panel is also responsible for keeping
the definition up to date with the panel's current state.public String getDefaultChildType()
getClass().getName().
Subclasses can override if they prefer a different child type.getDefaultChildType in interface WorkbenchPanelPresenterpublic void addPart(WorkbenchPartPresenter part)
addPart(org.uberfire.client.workbench.part.WorkbenchPartPresenter, String). Subclasses can
take advantage of this by only overriding the 2-arg version.addPart in interface WorkbenchPanelPresenterpart - the part to add. Must not be null, and must not currently belong to any panel.public void addPart(WorkbenchPartPresenter part, String contextId)
getPanelView(), ignoring the given contextId.
Subclasses that care about context id's will override this method.addPart in interface WorkbenchPanelPresenterpart - the part to add. Must not be null, and must not currently belong to any panel.WorkbenchPanelPresenter.addPart(WorkbenchPartPresenter)public boolean removePart(PartDefinition part)
WorkbenchPanelPresenterremovePart in interface WorkbenchPanelPresenterWorkbenchPanelPresenter.addPart(WorkbenchPartPresenter)public void addPanel(WorkbenchPanelPresenter child, Position position)
IllegalStateException. Subclasses may override and implement some other collision avoidance
strategy.addPanel in interface WorkbenchPanelPresenterchild - the panel to add. The presenter, its view, and its definition must not belong to any parent. As a side
effect of this call (if the call is successful), the given presenter, its view, and its definition
will get attached to their new parents.position - the position to add the child at. Different panel implementations support different position types.public boolean removePanel(WorkbenchPanelPresenter child)
WorkbenchPanelPresenterremovePanel in interface WorkbenchPanelPresenterchild - The child panel to remove. Must be a direct child of this panel, and must be empty (contain no parts
or child panels). Null is not permitted.public Map<Position,WorkbenchPanelPresenter> getPanels()
WorkbenchPanelPresentergetPanels in interface WorkbenchPanelPresenterprotected Position positionOf(WorkbenchPanelPresenter child)
public void changeTitle(PartDefinition part, String title, com.google.gwt.user.client.ui.IsWidget titleDecorator)
changeTitle in interface WorkbenchPanelPresenterpublic void setFocus(boolean hasFocus)
setFocus in interface WorkbenchPanelPresenterpublic boolean selectPart(PartDefinition part)
selectPart in interface WorkbenchPanelPresenterpublic void maximize()
WorkbenchPanelPresenterWorkbenchLayout.maximize in interface WorkbenchPanelPresenterpublic void unmaximize()
WorkbenchPanelPresenterunmaximize in interface WorkbenchPanelPresenterpublic WorkbenchPanelView<P> getPanelView()
WorkbenchPanelPresentergetPanelView in interface WorkbenchPanelPresenterpublic void onResize(int width,
int height)
onResize in interface WorkbenchPanelPresenterpublic Class<? extends WorkbenchPartPresenter> getPartType()
WorkbenchPanelPresentergetPartType in interface WorkbenchPanelPresenterCopyright © 2012–2020 JBoss by Red Hat. All rights reserved.