public class Desktop extends ej.microui.display.Displayable implements Renderable
Display.Display, and that relationship cannot be modified.Display.
A desktop can contains several Panel instances.
These panels are stored in a list. The order of the list defines the front-to-back stacking order of the panels
within the desktop. The first panel in the list is at the back of the stacking order.
Display,
Panel| Constructor and Description |
|---|
Desktop()
Creates a new desktop on the default display.
Identical to new Desktop(. |
Desktop(ej.microui.display.Display display)
Creates a new desktop on the specified display.
|
| Modifier and Type | Method and Description |
|---|---|
void |
becomeCurrent() |
Panel |
getActivePanel()
Gets this desktop's active panel.
|
ej.microui.util.EventHandler |
getController() |
ej.microui.util.EventHandler |
getEventHandler()
Gets the event handler.
|
int |
getHeight()
Returns the height of this desktop: it is equal to the height of its associated display.
|
Panel[] |
getPanels()
Gets the list of the panels being shown on this desktop.
|
int |
getWidth()
Returns the width of this desktop: it is equal to the width of its associated display.
|
int |
getX()
Returns the x coordinate of this desktop, which is always 0.
|
int |
getY()
Returns the y coordinate of this desktop, which is always 0.
|
boolean |
handleEvent(int event)
Called by the system if no widget nor panel in the focused hierarchy has consumed the event.
|
void |
hideNotify()
The desktop is hidden from its display.
|
boolean |
isAccessible(Panel panel)
Checks whether or not a panel is accessible to the user.
|
void |
paint(ej.microui.display.GraphicsContext g) |
Panel |
panelAt(int x,
int y)
Gets the panel at the specified position.
|
void |
render(ej.microui.display.GraphicsContext g)
Renders the renderable on the given graphics context.
|
void |
repaint(int x,
int y,
int width,
int height)
Requests a repaint of a zone of this desktop.
|
void |
revalidate()
Lays out all the hierarchy of this desktop.
|
void |
setActivePanel(Panel panel)
Sets the specified panel as the active one on this desktop.
|
void |
setEventHandler(ej.microui.util.EventHandler eventHandler)
Sets the event handler.
|
void |
showNotify()
The desktop is visible on its display.
|
void |
validate()
Lays out all the hierarchy of this desktop.
|
becomeHidden, getDisplay, hide, hideNotifyInternal, isShown, paintDisplayable, repaint, show, showNotifyInternalclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisShown, repaintpublic Desktop()
new Desktop(Display.getDefaultDisplay()).public Desktop(@NonNull
ej.microui.display.Display display)
throws java.lang.NullPointerException
display - the display for which the desktop is created.java.lang.NullPointerException - if display is null.public int getX()
getX in interface Renderablepublic int getY()
getY in interface Renderablepublic int getWidth()
getWidth in interface Renderablepublic int getHeight()
getHeight in interface Renderablepublic void repaint(int x,
int y,
int width,
int height)
This method returns immediately, the repaint of the desktop is performed asynchronously.
If the desktop is not shown, nothing is done.
repaint in interface Renderablex - the relative x coordinate of the area to repaint.y - the relative y coordinate of the area to repaint.width - the width of the area to repaint.height - the height of the area to repaint.public void render(@NonNull
ej.microui.display.GraphicsContext g)
Renderablerender in interface Renderableg - the graphics context to be used to draw the renderable.@Nullable public Panel getActivePanel()
null if none.public void setActivePanel(@NonNull
Panel panel)
throws java.lang.NullPointerException,
java.lang.IllegalArgumentException
panel - the panel to set activejava.lang.NullPointerException - if the specified panel is null.java.lang.IllegalArgumentException - if the specified panel is not on this desktop.getActivePanel()@NonNull public Panel[] getPanels()
A panel is added to this list when a panel is shown on this desktop and removed when a panel is hidden from this desktop.
Panel.showFullScreen(Desktop),
Panel.showAdjustingToChild(Desktop),
Panel.showUsingBounds(Desktop),
Panel.hide()public void revalidate()
It performs the method validate() asynchronously. Therefore this method does not block until the
validation of the hierarchy is done.
Nothing is done if it is not shown.
validate()public void validate()
Panel.validate()public void showNotify()
Notifies its children panels that they are shown.
Ask for a revalidation of the entire desktop.
showNotify in interface RenderableshowNotify in class ej.microui.display.Displayablerevalidate()public void hideNotify()
Notifies its children panels that they are hidden.
hideNotify in interface RenderablehideNotify in class ej.microui.display.Displayablepublic void becomeCurrent()
becomeCurrent in class ej.microui.display.Displayable@NonNull public ej.microui.util.EventHandler getController()
getController in class ej.microui.display.Displayablepublic void setEventHandler(@Nullable
ej.microui.util.EventHandler eventHandler)
RenderablesetEventHandler in interface RenderableeventHandler - the event handler to set.Renderable.handleEvent(int)@Nullable public ej.microui.util.EventHandler getEventHandler()
RenderablegetEventHandler in interface RenderableRenderable.handleEvent(int)public boolean handleEvent(int event)
handleEvent in interface Renderableevent - the event to handletrue if the desktop has consumed the event, false otherwisepublic final void paint(ej.microui.display.GraphicsContext g)
paint in class ej.microui.display.Displayable@Nullable public Panel panelAt(int x, int y)
x - the x coordinate to search at.y - the y coordinate to search at.null if none.public boolean isAccessible(@NonNull
Panel panel)
A panel is accessible if:
panel - the panel to check.true if the panel is accessible, false otherwise.