Package io.github.mmm.ui.spi.controller
Class AbstractUiController<V extends UiRegularWidget>
- java.lang.Object
-
- io.github.mmm.ui.spi.controller.AbstractUiController<V>
-
- Type Parameters:
V
- type of theview
.
- All Implemented Interfaces:
AttributeReadId
,AttributeReadTitle
,AttributeReadVisible
,UiController<V>
- Direct Known Subclasses:
AbstractUiControllerContent
,AbstractUiControllerNavigation
,UiControllerRoot
public abstract class AbstractUiController<V extends UiRegularWidget> extends Object implements UiController<V>
Abstract base implementation ofUiController
.- Since:
- 1.0.0
-
-
Field Summary
-
Fields inherited from interface io.github.mmm.ui.api.controller.UiController
ID_CONTENT, ID_FOOTER, ID_HEADER, ID_HOME, ID_MARGIN, ID_NAVIGATION, ID_PAGE, ID_ROOT
-
-
Constructor Summary
Constructors Constructor Description AbstractUiController()
The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract V
createView()
protected boolean
doEmbed(String slotId, UiController<?> childController)
Override this method for parent controllers to embed children.protected abstract UiEmbedding
doShow(UiPlace newPlace, UiEmbedding newSlot)
void
embed(UiEmbedding newEmbedding, UiController<?> childController)
protected UiEmbedding
getEmbedding()
String
getTitle()
V
getView()
void
hide()
This method is called when this controller was hidden (itsview
is replaced in the slot it was embedded by another controller).boolean
isVisible()
protected void
onHide()
This method gets called whenever theview
is hidden from the screen.protected void
onReset()
This method gets called whenever this controller isreseted
.protected void
onShow()
This method gets called whenever theview
is shown on the screen.void
reset()
This method resets thisAbstractUiController
and disposes itsview
.UiEmbedding
show(UiPlace newPlace)
UiEmbedding
show(UiPlace newPlace, UiEmbedding newEmbedding)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.ui.api.controller.UiController
getId, isNavigable
-
-
-
-
Method Detail
-
getView
public V getView()
- Specified by:
getView
in interfaceUiController<V extends UiRegularWidget>
- Returns:
- the view of this
UiController
. The view is the actual UI represented by aUiWidget
, typically aregular widget
.
-
getTitle
public String getTitle()
- Specified by:
getTitle
in interfaceAttributeReadTitle
- Specified by:
getTitle
in interfaceUiController<V extends UiRegularWidget>
- Returns:
- the title of this object. Similar to
text
but more exposed (e.g. displayed in title-bar in case of a window). Will be the emptyString
if not set.
-
getEmbedding
protected UiEmbedding getEmbedding()
- Returns:
- the
UiEmbedding
where this controller isembedded into its parent controller
.
-
show
public final UiEmbedding show(UiPlace newPlace)
- Parameters:
newPlace
- theUiPlace
identifying
thisUiController
and providing potentialparameters
.- Returns:
- the
UiEmbedding
where to embed this controller into a parent controller ornull
if this is the root controller.
-
show
public final UiEmbedding show(UiPlace newPlace, UiEmbedding newEmbedding)
- Parameters:
newPlace
- theUiPlace
to open. Itidentifies
the leaf childUiController
and provides potentialparameters
.newEmbedding
- the optionalUiEmbedding
where to embed the child controller.- Returns:
- the
UiEmbedding
where to embed this controller into a parent controller ornull
if this is the root controller.
-
doShow
protected abstract UiEmbedding doShow(UiPlace newPlace, UiEmbedding newSlot)
- Parameters:
newPlace
- theUiPlace
to open. Itidentifies
the leaf childUiController
and provides potentialparameters
.newSlot
- the optionalUiEmbedding
where to embed the child controller.- Returns:
- the
UiEmbedding
where to embed this controller into a parent controller ornull
if this is the root controller.
-
embed
public final void embed(UiEmbedding newEmbedding, UiController<?> childController)
Description copied from interface:UiController
- Specified by:
embed
in interfaceUiController<V extends UiRegularWidget>
- Parameters:
newEmbedding
- theslotId
where to embed the given childUiController
sview
.childController
- the child controller to embed.
-
doEmbed
protected boolean doEmbed(String slotId, UiController<?> childController)
Override this method for parent controllers to embed children.- Parameters:
slotId
- theslot ID
where to embed the given childUiController
sview
.childController
- the child controller to embed.- Returns:
true
if the embedded slot is dynamic (e.g. a new closable tab),false
otherwise if static and reusable slot in the UI (default).- See Also:
embed(UiEmbedding, UiController)
-
isVisible
public boolean isVisible()
- Specified by:
isVisible
in interfaceAttributeReadVisible
- Returns:
true
if visible,false
if hidden.
-
reset
public final void reset()
This method resets thisAbstractUiController
and disposes itsview
.
-
hide
public final void hide()
This method is called when this controller was hidden (itsview
is replaced in the slot it was embedded by another controller).
-
onReset
protected void onReset()
This method gets called whenever this controller isreseted
. If you keep custom state information you need to override and reset your state.
-
onShow
protected void onShow()
This method gets called whenever theview
is shown on the screen. It can be overridden to trigger custom logic - e.g. to update data.
-
onHide
protected void onHide()
This method gets called whenever theview
is hidden from the screen. It can be overridden to trigger custom logics or to clean up resources.
-
-