Package ej.microui.display
Class Displayable
- java.lang.Object
-
- ej.microui.display.Displayable
-
- All Implemented Interfaces:
EventHandler
- Direct Known Subclasses:
Desktop
public abstract class Displayable extends Object implements EventHandler
Displayableis an abstract class which defines the very objects that can be shown on theDisplay.
ADisplayablemay be shown or hidden, but at most oneDisplayableis shown on theDisplay.
Subclasses should define theDisplayablecontents and their possible interactions with the user.
By default, a newDisplayableobject is not visible on the display.- See Also:
Display
-
-
Constructor Summary
Constructors Constructor Description Displayable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidonHidden()This method is called by system as soon as the displayable becomes hidden.protected voidonShown()This method is called by system as soon as the displayable becomes visible.protected abstract voidrender(GraphicsContext gc)Renders the displayable.voidrequestRender()Requests a rendering for the entire displayable.-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ej.microui.event.EventHandler
handleEvent
-
-
-
-
Method Detail
-
requestRender
public void requestRender()
Requests a rendering for the entire displayable. Calling this method may result in subsequent call torender(GraphicsContext)on the displayable.The call to
render(GraphicsContext)occurs asynchronously to this call. That is, this method will not block waiting forrender(GraphicsContext)to finish. After render action (after call torender(GraphicsContext)), a call toDisplay.flush()is synchronously performed.This call may have no effect under certain conditions:
- if the displayable is not visible on the display (see
Display.isShown(Displayable)): the request is refused. - if the displayable is not visible on the display when the event is executed (a call to
Display.requestShow(Displayable)has been performed with another displayable): the request is abandoned (this displayable is no longer the current displayable). - if a request is already available in the events queue and if the request is called from the MicroUI pump: the request is useless because this request has been already added and cannot be executed until the end of current caller method. The request is not added into the queue.
- if the displayable is not visible on the display (see
-
onShown
protected void onShown()
This method is called by system as soon as the displayable becomes visible. Application should override this method to control its own displayables. Default behavior does nothing.- See Also:
Display.requestShow(Displayable)
-
onHidden
protected void onHidden()
This method is called by system as soon as the displayable becomes hidden. Application should override this method to control its own displayables. Default behavior does nothing.- See Also:
Display.requestHide(Displayable)
-
render
protected abstract void render(GraphicsContext gc)
Renders the displayable. This method is called by system as soon as the displayable has be rendered. Caller ensures the graphics context's clip and translate are reseted.- Parameters:
gc- the graphics context of display.
-
-