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 |
---|---|
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.
A panel is added to this list when it executes Panel.show(Desktop) and removed when it executes
Panel.hide() . |
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.
|
getDisplay, hide, isShown, repaint, show
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isShown, repaint
public Desktop()
new Desktop(Display.getDefaultDisplay()
)
.public Desktop(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 Renderable
public int getY()
getY
in interface Renderable
public int getWidth()
getWidth
in interface Renderable
public int getHeight()
getHeight
in interface Renderable
public 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 Renderable
x
- 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(ej.microui.display.GraphicsContext g)
Renderable
render
in interface Renderable
g
- the graphics context to be used to draw the renderable.public Panel getActivePanel()
null
if nonepublic void setActivePanel(Panel panel) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
panel
- the panel to set activejava.lang.NullPointerException
- if the specified panel is nulljava.lang.IllegalArgumentException
- if the specified panel is not on this desktopgetActivePanel()
public Panel[] getPanels()
Panel.show(Desktop)
and removed when it executes
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 Renderable
showNotify
in class ej.microui.display.Displayable
revalidate()
public void hideNotify()
Notifies its children panels that they are hidden.
hideNotify
in interface Renderable
hideNotify
in class ej.microui.display.Displayable
public ej.microui.util.EventHandler getController()
getController
in class ej.microui.display.Displayable
public void setEventHandler(ej.microui.util.EventHandler eventHandler)
Renderable
setEventHandler
in interface Renderable
eventHandler
- the event handler to set.Renderable.handleEvent(int)
public ej.microui.util.EventHandler getEventHandler()
Renderable
getEventHandler
in interface Renderable
Renderable.handleEvent(int)
public boolean handleEvent(int event)
handleEvent
in interface Renderable
event
- 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
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(Panel panel)
A panel is accessible if:
panel
- the panel to check.true
if the panel is accessible, false
otherwise.