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 VcreateView()protected booleandoEmbed(String slotId, UiController<?> childController)Override this method for parent controllers to embed children.protected abstract UiEmbeddingdoShow(UiPlace newPlace, UiEmbedding newSlot)voidembed(UiEmbedding newEmbedding, UiController<?> childController)protected UiEmbeddinggetEmbedding()StringgetTitle()VgetView()voidhide()This method is called when this controller was hidden (itsviewis replaced in the slot it was embedded by another controller).booleanisVisible()protected voidonHide()This method gets called whenever theviewis hidden from the screen.protected voidonReset()This method gets called whenever this controller isreseted.protected voidonShow()This method gets called whenever theviewis shown on the screen.voidreset()This method resets thisAbstractUiControllerand disposes itsview.UiEmbeddingshow(UiPlace newPlace)UiEmbeddingshow(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:
getViewin 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:
getTitlein interfaceAttributeReadTitle- Specified by:
getTitlein interfaceUiController<V extends UiRegularWidget>- Returns:
- the title of this object. Similar to
textbut more exposed (e.g. displayed in title-bar in case of a window). Will be the emptyStringif not set.
-
getEmbedding
protected UiEmbedding getEmbedding()
- Returns:
- the
UiEmbeddingwhere this controller isembedded into its parent controller.
-
show
public final UiEmbedding show(UiPlace newPlace)
- Parameters:
newPlace- theUiPlaceidentifyingthisUiControllerand providing potentialparameters.- Returns:
- the
UiEmbeddingwhere to embed this controller into a parent controller ornullif this is the root controller.
-
show
public final UiEmbedding show(UiPlace newPlace, UiEmbedding newEmbedding)
- Parameters:
newPlace- theUiPlaceto open. Itidentifiesthe leaf childUiControllerand provides potentialparameters.newEmbedding- the optionalUiEmbeddingwhere to embed the child controller.- Returns:
- the
UiEmbeddingwhere to embed this controller into a parent controller ornullif this is the root controller.
-
doShow
protected abstract UiEmbedding doShow(UiPlace newPlace, UiEmbedding newSlot)
- Parameters:
newPlace- theUiPlaceto open. Itidentifiesthe leaf childUiControllerand provides potentialparameters.newSlot- the optionalUiEmbeddingwhere to embed the child controller.- Returns:
- the
UiEmbeddingwhere to embed this controller into a parent controller ornullif this is the root controller.
-
embed
public final void embed(UiEmbedding newEmbedding, UiController<?> childController)
Description copied from interface:UiController- Specified by:
embedin interfaceUiController<V extends UiRegularWidget>- Parameters:
newEmbedding- theslotIdwhere to embed the given childUiControllersview.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 IDwhere to embed the given childUiControllersview.childController- the child controller to embed.- Returns:
trueif the embedded slot is dynamic (e.g. a new closable tab),falseotherwise if static and reusable slot in the UI (default).- See Also:
embed(UiEmbedding, UiController)
-
isVisible
public boolean isVisible()
- Specified by:
isVisiblein interfaceAttributeReadVisible- Returns:
trueif visible,falseif hidden.
-
reset
public final void reset()
This method resets thisAbstractUiControllerand disposes itsview.
-
hide
public final void hide()
This method is called when this controller was hidden (itsviewis 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 theviewis 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 theviewis hidden from the screen. It can be overridden to trigger custom logics or to clean up resources.
-
-