Package overit.geocall.ui
Class Tooltip
java.lang.Object
overit.geocall.ui.Tooltip
- All Implemented Interfaces:
SingleUseComponent
The class implements the user interface element that should be used to display on-screen messages that appears in popups
but without blocking the user interaction. For this reason they can be informational messages or messages that contains some details
that must be showed only on demand. When the tooltip appears, the user can interact with it or not.
If the user click anywhere outside from the tooltip, the tooltip will be closed.
The tooltip can be active, so it can contain buttons and radio params that allows the user to make a choice from a list of possibilities.
The class implements the
The tooltip can be active, so it can contain buttons and radio params that allows the user to make a choice from a list of possibilities.
The class implements the
SingleUseComponent interface.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe class implements a clickable button that can be added to the tooltipstatic classThe class implements one choice that can be added to the tooltip to create a multiple choice -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<Tooltip.Button> protected intprotected Stringprotected Stringprotected Object[]protected Mapprotected ArrayList<Tooltip.RadioParam> protected static AtomicLongprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Tooltip.Button button) Adds aTooltip.Buttonto the bottom of the tooltipvoidadd(Tooltip.RadioParam radio) Adds aTooltip.RadioParamto the body of the tooltipvoidAdds a clickable button (Tooltip.Button) to the bottom of the tooltipvoidaddButton(String label, String icon, String event, String id, String param, String msg, String prompt) Adds a clickable button (Tooltip.Button) to the bottom of the tooltipvoidaddRadioParam(String label, String param, boolean def) Adds a radio param (Tooltip.RadioParam) to the body of the tooltip.voidEvery component can add a script to the StringBuilder, script executed when the component is created The method add the script that manage the creation and showing of the tooltipReturns the list ofTooltip.Buttonof the tooltipprotected org.apache.ecs.Elementorg.apache.ecs.ElementReturns the html code of the alertReturns the tooltip's messageReturns theTeacher, the object that manages the translationsgetTitle()Returns the tooltip's titlevoidsetDefaultButton(int def) Sets wich one must be the default button for the tooltipvoidsetMessage(String message) Sets the message of the tooltip, the string that appears in the tooltip's bodyvoidsetMessage(String sMessage, Object[] oo) Sets the message (seeTextFormat) of the tooltip and the objects that will be used to fill in the messagevoidsetMessage(String sMessage, Map params) Sets the message (seeMapFormat) of the tooltip and the map that will be used to fill in the messagevoidSets the title of the tooltip, the string that appears in the tooltip's header
-
Field Details
-
_sequence
-
_title
-
_message
-
_objects
-
_params
-
_buttons
-
_defaultButton
protected int _defaultButton -
_radios
-
_id
-
-
Constructor Details
-
Tooltip
Creates an empty tooltip- Parameters:
teacher- The component that manage the translations (seeTeacher)
-
Tooltip
Creates a tooltip with the specific title and message- Parameters:
title- The string that appears in the header of the tooltipmessage- The message that appears in the tooltip's bodyteacher- The component that manage the translations (seeTeacher)
-
-
Method Details
-
getTeacher
Returns theTeacher, the object that manages the translations- Returns:
- The
Teacherthat manages the translations
-
setTitle
Sets the title of the tooltip, the string that appears in the tooltip's header- Parameters:
title- The title that appears in the header
-
setMessage
Sets the message of the tooltip, the string that appears in the tooltip's body- Parameters:
message- The message that appears in the body
-
setMessage
Sets the message (seeTextFormat) of the tooltip and the objects that will be used to fill in the message- Parameters:
sMessage- The message that appears in the bodyoo- The objects that will be used to fill in the message
-
setMessage
Sets the message (seeMapFormat) of the tooltip and the map that will be used to fill in the message- Parameters:
sMessage- The message that appears in the bodyparams- The map that will be used to fill in the message
-
getTitle
Returns the tooltip's title- Returns:
- The string that represents the tooltip title
-
getMessage
Returns the tooltip's message- Returns:
- The string that represents the tooltip message
-
setDefaultButton
public void setDefaultButton(int def) Sets wich one must be the default button for the tooltip- Parameters:
def- The integer that defines the position (from left to right) of the button that must be the default one
-
addButton
Adds a clickable button (Tooltip.Button) to the bottom of the tooltip- Parameters:
label- The label that appears on the buttonicon- The icon that appears on the buttonevent- The event triggered when the user clicks on the buttonid- The target for the event
-
addButton
public void addButton(String label, String icon, String event, String id, String param, String msg, String prompt) Adds a clickable button (Tooltip.Button) to the bottom of the tooltip- Parameters:
label- The label that appears on the buttonicon- The icon that appears on the buttonevent- The event triggered when the user clicks on the buttonid- The target for the eventparam- The parameter passed to the event triggered when the user clicks the buttonmsg- The string that appears as a message when the user clicks the buttonprompt- The string that appears as a prompt when the user clicks the button
-
addRadioParam
Adds a radio param (Tooltip.RadioParam) to the body of the tooltip. Use this method to add multiple choices selectable with a single button, and prevent a large number of buttons.- Parameters:
label- The label string associated to the chioceparam- The parameter associated to the chioce, passed to the event of the button of the tooltipdef- true if this one must be the default selected choice when the tooltip appears, false otherwise
-
add
Adds aTooltip.Buttonto the bottom of the tooltip- Parameters:
button- The button to add to the tooltip
-
add
Adds aTooltip.RadioParamto the body of the tooltip- Parameters:
radio- The radio param to add to the tooltip
-
getButtons
Returns the list ofTooltip.Buttonof the tooltip- Returns:
- The list of buttons
-
getHtml
Returns the html code of the alert- Specified by:
getHtmlin interfaceSingleUseComponent- Parameters:
es- TheEntitySetto which the element belongsw- TheWindowcurrently displayed- Returns:
- The html code of the alert
-
buildSetupScript
Every component can add a script to the StringBuilder, script executed when the component is created The method add the script that manage the creation and showing of the tooltip- Specified by:
buildSetupScriptin interfaceSingleUseComponent- Parameters:
sb- The StringBuilder on which we want to add the script
-