VIEW - is the generic type of the view.public abstract class DialogController<VIEW extends UiWidget> extends AbstractDialogController<VIEW> implements Dialog
controller of a Dialog.
For each ApplicationWindow a single instance of
DialogController exists for each Dialog holding its state.
public class PageDialogController extendsDialogController<MyPageView> { ... public StringAbstractDialog.getId(){ returnDialogConstants.DIALOG_ID_PAGE; } protectedDialogSlotdoShow(DialogPlaceplace) { returnDialogConstants.SLOT_ROOT_PAGE; } protected void embed(DialogController> subDialog,DialogSlotslot) { if (slot == SLOT_MAIN) { this.widgetMainSlot.setChild(subDialog.getView()); } else if (slot == SLOT_...) { ... } else { super.embed(subDialog, slot); } } }
| Modifier and Type | Field and Description |
|---|---|
private AbstractDialogManager |
dialogManager |
private DialogController<?> |
parent
The parent
DialogController or null for no parent (if this is the root
DialogController or not opened). |
private DialogPlace |
place |
private Map<DialogSlot,DialogController<?>> |
slot2subDialogMap |
private UiContext |
uiContext |
PATTERN_DIALOG_ID| Constructor and Description |
|---|
DialogController()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract DialogSlot |
doShow(DialogPlace dialogPlace)
This method gets called whenever this
DialogController is to be shown. |
protected void |
embed(DialogController<?> subDialog,
DialogSlot slot)
This method has to be overridden with the custom logic to embed a given
DialogController as
sub-dialog in a predefined slot. |
protected DialogManager |
getDialogManager() |
(package private) DialogController<?> |
getParent() |
UiContext |
getUiContext() |
protected void |
onRemoveChild(DialogController<?> subDialog)
This method notifies that the given
DialogController has been removed as a sub-dialog. |
(package private) void |
setDialogManager(AbstractDialogManager dialogManager) |
(package private) void |
setParent(DialogController<?> parent)
This method sets the parent
DialogController when embedding. |
(package private) void |
setSubDialog(DialogController<?> subDialog,
DialogSlot slot,
DialogPlace dialogPlace)
This method embeds the given
subDialog inside the given slot of this dialog. |
void |
setUiContext(UiContext uiContext) |
(package private) void |
setVisible(boolean visible)
This method sets the
visible flag and on change it triggers AbstractDialogController.onShow() or
AbstractDialogController.onHide() accordingly. |
void |
show(DialogPlace dialogPlace)
This method opens this dialog as triggered by the given
DialogPlace. |
private DialogSlot |
showInternal(DialogPlace dialogPlace) |
createView, getView, isVisible, onHide, onReset, onShow, resetcreateLogger, doInitialize, getLoggerdoInitialized, getInitializationState, initializeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetId, getTitle, isVisibleprivate final Map<DialogSlot,DialogController<?>> slot2subDialogMap
private AbstractDialogManager dialogManager
getDialogManager()private UiContext uiContext
setUiContext(UiContext)private DialogController<?> parent
DialogController or null for no parent (if this is the root
DialogController or not opened).private DialogPlace place
show(DialogPlace)DialogController<?> getParent()
DialogController or null if NOT visible or
root.void setParent(DialogController<?> parent)
DialogController when embedding.parent - is the parent DialogController or null to reset.protected void onRemoveChild(DialogController<?> subDialog)
DialogController has been removed as a sub-dialog.subDialog - is the child DialogController that has been removed.void setVisible(boolean visible)
visible flag and on change it triggers AbstractDialogController.onShow() or
AbstractDialogController.onHide() accordingly.setVisible in class AbstractDialogController<VIEW extends UiWidget>visible - - true if this controller is about to show its view,
false if it will hide it.protected DialogManager getDialogManager()
DialogManager instance.void setDialogManager(AbstractDialogManager dialogManager)
dialogManager - is the instance of AbstractDialogManager to use.public final void show(DialogPlace dialogPlace)
DialogPlace.dialogPlace - is the DialogPlace identifying this
DialogController and providing potential parameters.private DialogSlot showInternal(DialogPlace dialogPlace)
dialogPlace - is the DialogPlace pointing to the
direct dialog to open and containing potential parameters.DialogSlot identifying the parent
DialogController and its slot where to embed this DialogController.protected abstract DialogSlot doShow(DialogPlace dialogPlace)
DialogController is to be shown. There are two cases to
distinguish:
DialogController is identified by the given DialogPlace. It is the leaf of the
DialogController-hierarchy that is to be displayed.show a dialog, its parent (and ancestors)
will be shown that will embed their child dialog in the DialogSlot returned by this method.root DialogController this method will never be
called.dialogPlace - is the DialogPlace pointing to the
direct dialog to open and containing potential parameters.DialogSlot identifying the parent
DialogController and its slot where to embed this DialogController.final void setSubDialog(DialogController<?> subDialog, DialogSlot slot, DialogPlace dialogPlace)
subDialog inside the given slot of this dialog.
The subDialog previously set in that slot is replaced with the new one.subDialog - is the DialogController of the sub-dialog to embed.slot - is the DialogSlot identifying the location in the view where the
subDialog shall be embedded.dialogPlace - is the DialogPlace pointing to the child (or
descendant) dialog to embed.protected void embed(DialogController<?> subDialog, DialogSlot slot)
DialogController as
sub-dialog in a predefined slot. If this DialogController represents a leaf-dialog than can not
have sub-dialogs this method will be never called. protected void embed(The cast toDialogControllersubDialog,DialogSlotslot) { if (slot == SLOT_MAIN) {AbstractDialogController.getView().getMainSlot().setChild((UiWidgetRegular) subDialog.AbstractDialogController.getView()); } else if (slot == SLOT_NAVIGATION) { ... } else { super.embed(subDialog, slot); } }
UiWidgetRegular is legal here if you are not doing
odd things. See AbstractDialogController.getView() for details.subDialog - is the DialogController of the sub-dialog to embed.slot - is the DialogSlot identifying the location in the view where the
subDialog shall be embedded.public UiContext getUiContext()
@Inject public void setUiContext(UiContext uiContext)
uiContext - is the uiContext to setCopyright © 2001–2016 mmm-Team. All rights reserved.