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<org.uberfire.workbench.model.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,
org.uberfire.workbench.model.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(org.uberfire.workbench.model.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() . |
org.uberfire.workbench.model.PanelDefinition |
getDefinition()
Returns a
@Portable description of the current state of this panel. |
Map<org.uberfire.workbench.model.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 org.uberfire.workbench.model.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(org.uberfire.workbench.model.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(org.uberfire.workbench.model.PartDefinition part) |
void |
setDefinition(org.uberfire.workbench.model.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<org.uberfire.workbench.model.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()
WorkbenchPanelPresenter
getParent
in interface WorkbenchPanelPresenter
public void setParent(WorkbenchPanelPresenter parent)
WorkbenchPanelPresenter
setParent
in interface WorkbenchPanelPresenter
parent
- the new parent of this panel. If this panel is being removed, the parent should be set to null.public org.uberfire.workbench.model.PanelDefinition getDefinition()
WorkbenchPanelPresenter
@Portable
description of the current state of this panel.getDefinition
in interface WorkbenchPanelPresenter
public void setDefinition(org.uberfire.workbench.model.PanelDefinition definition)
WorkbenchPanelPresenter
setDefinition
in interface WorkbenchPanelPresenter
definition
- 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 WorkbenchPanelPresenter
public 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 WorkbenchPanelPresenter
part
- 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 WorkbenchPanelPresenter
part
- the part to add. Must not be null, and must not currently belong to any panel.WorkbenchPanelPresenter.addPart(WorkbenchPartPresenter)
public boolean removePart(org.uberfire.workbench.model.PartDefinition part)
WorkbenchPanelPresenter
removePart
in interface WorkbenchPanelPresenter
WorkbenchPanelPresenter.addPart(WorkbenchPartPresenter)
public void addPanel(WorkbenchPanelPresenter child, org.uberfire.workbench.model.Position position)
IllegalStateException
. Subclasses may override and implement some other collision avoidance
strategy.addPanel
in interface WorkbenchPanelPresenter
child
- 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)
WorkbenchPanelPresenter
removePanel
in interface WorkbenchPanelPresenter
child
- 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<org.uberfire.workbench.model.Position,WorkbenchPanelPresenter> getPanels()
WorkbenchPanelPresenter
getPanels
in interface WorkbenchPanelPresenter
protected org.uberfire.workbench.model.Position positionOf(WorkbenchPanelPresenter child)
public void changeTitle(org.uberfire.workbench.model.PartDefinition part, String title, com.google.gwt.user.client.ui.IsWidget titleDecorator)
changeTitle
in interface WorkbenchPanelPresenter
public void setFocus(boolean hasFocus)
setFocus
in interface WorkbenchPanelPresenter
public boolean selectPart(org.uberfire.workbench.model.PartDefinition part)
selectPart
in interface WorkbenchPanelPresenter
public void maximize()
WorkbenchPanelPresenter
WorkbenchLayout
.maximize
in interface WorkbenchPanelPresenter
public void unmaximize()
WorkbenchPanelPresenter
unmaximize
in interface WorkbenchPanelPresenter
public WorkbenchPanelView<P> getPanelView()
WorkbenchPanelPresenter
getPanelView
in interface WorkbenchPanelPresenter
public void onResize(int width, int height)
onResize
in interface WorkbenchPanelPresenter
public Class<? extends WorkbenchPartPresenter> getPartType()
WorkbenchPanelPresenter
getPartType
in interface WorkbenchPanelPresenter
Copyright © 2012–2019 JBoss by Red Hat. All rights reserved.