com.intel.ui
Class Dialog
- java.lang.Object
-
- com.intel.ui.Dialog
-
public abstract class Dialog extends java.lang.Object
This abstract class represents a top-level container for all the other Widgets. When all Widgets are in place, the dialog object can be passed toProtectedOutput
class to generate the image.- See Also:
ProtectedOutput
-
-
Field Summary
Fields Modifier and Type Field and Description static short
DIALOG_MAX_HEIGHT
Limit to dialog height.static short
DIALOG_MAX_WIDTH
Limit to dialog width.static short
DIALOG_MIN_WIDTH
Limit to dialog width.
-
Method Summary
Methods Modifier and Type Method and Description void
addWidget(Widget widget)
Adds a child widget to thisDialog
.void
addWidgets(Widget[] widgets)
Adds child widgets to thisDialog
.static Dialog
create(int bgColor, XYPair size)
Factory method for creating a concrete instance initialized with the specified parametersint
getBgColor()
Returns the dialog background color in RGB format (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).abstract WidgetMapping[]
getClickableWidgetMappings()
Returns the mappings of theClickable
widgets in thisDialog
.abstract Widget
getClickedWidget(XYPair clickLocation)
Checks whether one of theClickable
widgets in thisDialog
object intersects with a mouse click and returns the intersected widget.XYPair
getSize()
Returns theDialog
size in pixelsWidget[]
getWidgets()
Returns the widget list thisDialog
contains.
-
-
-
Field Detail
-
DIALOG_MIN_WIDTH
public static final short DIALOG_MIN_WIDTH
Limit to dialog width.- See Also:
- Constant Field Values
-
DIALOG_MAX_WIDTH
public static final short DIALOG_MAX_WIDTH
Limit to dialog width.- See Also:
- Constant Field Values
-
DIALOG_MAX_HEIGHT
public static final short DIALOG_MAX_HEIGHT
Limit to dialog height.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static final Dialog create(int bgColor, XYPair size) throws UiException
Factory method for creating a concrete instance initialized with the specified parameters- Parameters:
bgColor
- The background color of theDialog
in RGB format (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).size
- The size of theDialog
.- Returns:
Dialog
instance- Throws:
UiIllegalParameterException
- in one of the following cases:-
Dialog
width is less thanDialog.MIN_WIDTH
-
Dialog
width is more thanDialog.MAX_WIDTH
-
Dialog
height is non-positive or exceedsDialog.MAX_HEIGHT
-
UiException
-
getWidgets
public final Widget[] getWidgets()
Returns the widget list thisDialog
contains.- Returns:
- Returns the widget list this
Dialog
contains or null if there are no child widgets.
-
addWidget
public final void addWidget(Widget widget) throws UiException
Adds a child widget to thisDialog
.- Parameters:
widget
- TheWidget
to add. Cannot be null.- Throws:
UiIllegalParameterException
- if the size or location of the widget being added exceed the dialog boundaries.UiException
-
addWidgets
public final void addWidgets(Widget[] widgets) throws UiException
Adds child widgets to thisDialog
.- Parameters:
widgets
- TheWidget
array to add. Cannot be null or contain null members.- Throws:
UiIllegalParameterException
- if the size or location of one of the widgets being added exceed the dialog boundaries.UiException
-
getSize
public XYPair getSize()
Returns theDialog
size in pixels- Returns:
- Returns the
Dialog
size in pixels
-
getBgColor
public int getBgColor()
Returns the dialog background color in RGB format (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).- Returns:
- Returns the background color in RGB format (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).
-
getClickedWidget
public abstract Widget getClickedWidget(XYPair clickLocation) throws UiException
Checks whether one of theClickable
widgets in thisDialog
object intersects with a mouse click and returns the intersected widget. If more than one widget in the same level intersects the mouse click, there is no guarantee which widget will be returned by this method. Note that the dialog must be rendered before calling this method.- Returns:
- Returns the widget that intersects with the mouse click, or null of none of the
Clickable
widgets inside this dialog intersect with the mouse click. - Throws:
UiNotInitializedException
- if this dialog was not rendered yet.UiIllegalParameterException
- if clicked location is either negative or bigger than theDialog
width or height.UiException
-
getClickableWidgetMappings
public abstract WidgetMapping[] getClickableWidgetMappings() throws UiException
Returns the mappings of theClickable
widgets in thisDialog
. Note that the dialog must be rendered before calling this method.- Returns:
- Returns the mappings of the
Clickable
widgets in thisDialog
. - Throws:
UiNotInitializedException
- if this dialog was not rendered yet.UiException
-
-