Package com.biglybt.ui.swt.shells
Class MessageBoxShell
java.lang.Object
com.biglybt.ui.swt.shells.MessageBoxShell
- All Implemented Interfaces:
UIFunctionsUserPrompter
A messagebox that allows you config the button
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private int
private boolean
private String[]
private Integer[]
private boolean
private String
private int
private int
private org.eclipse.swt.widgets.Listener
private boolean
private String
private org.eclipse.swt.graphics.Image
private String
private org.eclipse.swt.graphics.Image
private String
protected boolean
private static Map
<String, MessageBoxShell> private int
private static final int
private static final int
private int
private static final int
private int
private static final int
private boolean
private static int
private boolean
private org.eclipse.swt.widgets.Shell
private Object[]
private boolean
private String
private int
private String
private int
private UserPrompterResultListener
private org.eclipse.swt.widgets.Shell
private boolean
static final String
private boolean
private final String
private final String
private String
protected org.eclipse.swt.graphics.Color
private boolean
Fields inherited from interface com.biglybt.ui.UIFunctionsUserPrompter
ICON_ERROR, ICON_INFO, ICON_WARNING
-
Constructor Summary
ConstructorsConstructorDescriptionMessageBoxShell
(int style, String title, String text) Open a messagebox with actual title and textMessageBoxShell
(int style, String keyPrefix, String[] textParams) Open a messagebox using resource keys for title/textMessageBoxShell
(String title, String text) MessageBoxShell
(String title, String text, String[] buttons, int defaultOption) MessageBoxShell
(org.eclipse.swt.widgets.Shell parent, String title, String text, String[] buttons, int defaultOption) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
_open()
void
addCheckBox
(String cbMessageID, int cbMinUserMode, boolean defaultOn) Adds a checkbox to the message box.void
close()
private org.eclipse.swt.widgets.Canvas
createLinkLabel
(org.eclipse.swt.widgets.Composite shell, String text) private org.eclipse.swt.widgets.Control
createTextBox
(org.eclipse.swt.widgets.Composite textComposite, String text2) boolean
int
Returns the number milliseconds the prompt will wait around until it auto closes.private int
getButtonPos
(int buttonVal) String[]
private int
getButtonVal
(int buttonPos) boolean
getHtml()
Returns the HTML that will be displayed along with the promptorg.eclipse.swt.widgets.Shell
Object[]
Retrieves the Remember ID associated with this promptint
Retrieves the text to be displayed by the "Remember this Action" checkboxint
org.eclipse.swt.graphics.Color
boolean
Determines if the prompt was auto closed afterinvalid reference
#open()
static boolean
isOpen()
boolean
static void
int
open()
Deprecated.private void
open
(boolean useCustomShell) void
Opens the prompt.static void
open
(org.eclipse.swt.widgets.Shell parent, String title, String text, String[] buttons, int defaultOption, String rememberID, String rememberText, boolean bRememberByDefault, int autoCloseInMS, UserPrompterResultListener l) void
void
setAutoCloseInMS
(int autoCloseInMS) Sets the # of milliseconds before auto closing.void
setBrowserFollowLinks
(boolean follow) void
setButtons
(int defaltButtonPos, String[] buttons, Integer[] buttonVals) void
setButtons
(String[] buttons) void
setDefaultButtonUsingStyle
(int defaultStyle) void
setHandleHTML
(boolean handleHTML) void
void
setIconResource
(String resource) void
setLeftImage
(int icon) Replaces Image on left with iconvoid
setLeftImage
(String id) void
setLeftImage
(org.eclipse.swt.graphics.Image imgLeft) void
setModal
(boolean m) Only use this if you REALLY know what you're doing as in general it is a bad thing - check comments in this classvoid
setOneInstanceOf
(String instanceID) Prevent more than one dialog of instanceID from showing up at oncevoid
setParent
(org.eclipse.swt.widgets.Shell parent) void
setRelatedObject
(Object relatedObject) void
setRelatedObjects
(Object[] relatedObjects) void
setRemember
(String rememberID, boolean rememberByDefault, String rememberText) void
setRememberOnlyIfButton
(int rememberOnlyIfButton) void
setRememberText
(String rememberText) void
setSize
(int width, int height) void
setSquish
(boolean b) void
void
setUrlColor
(org.eclipse.swt.graphics.Color colorURL) void
setUseTextBox
(boolean useTextBox) private static Object[]
swtButtonStylesToText
(int style) private void
triggerResultListener
(int returnVal) boolean
int
NOT RECOMMENDED!
-
Field Details
-
STATUS_TEXT_CLOSE
- See Also:
-
MIN_SIZE_X_DEFAULT
private static final int MIN_SIZE_X_DEFAULT- See Also:
-
MIN_SIZE_Y_DEFAULT
private static final int MIN_SIZE_Y_DEFAULT- See Also:
-
MAX_SIZE_X_DEFAULT
private static final int MAX_SIZE_X_DEFAULT- See Also:
-
MIN_BUTTON_SIZE
private static final int MIN_BUTTON_SIZE- See Also:
-
numOpen
private static int numOpen -
parent
private org.eclipse.swt.widgets.Shell parent -
min_size_x
private int min_size_x -
min_size_y
private int min_size_y -
max_size_x
private int max_size_x -
title
-
text
-
buttons
-
buttonVals
-
defaultButtonPos
private int defaultButtonPos -
rememberID
-
rememberText
-
rememberByDefault
private boolean rememberByDefault -
rememberOnlyIfButtonPos
private int rememberOnlyIfButtonPos -
autoCloseInMS
private int autoCloseInMS -
html
-
url
-
squish
private boolean squish -
autoClosed
private boolean autoClosed -
imgLeft
private org.eclipse.swt.graphics.Image imgLeft -
urlColor
protected org.eclipse.swt.graphics.Color urlColor -
handleHTML
private boolean handleHTML -
iconImage
private org.eclipse.swt.graphics.Image iconImage -
browser_follow_links
private boolean browser_follow_links -
isRemembered
protected boolean isRemembered -
supportsApplyToAll
private boolean supportsApplyToAll -
applyToAll
private boolean applyToAll -
iconImageID
-
resultListener
-
result
private int result -
filterListener
private org.eclipse.swt.widgets.Listener filterListener -
shell
private org.eclipse.swt.widgets.Shell shell -
opened
private boolean opened -
useTextBox
private boolean useTextBox -
cbMessageID
-
cbMinUserMode
private int cbMinUserMode -
cbEnabled
private boolean cbEnabled -
instanceID
-
modal
private boolean modal -
mapInstances
-
-
Constructor Details
-
MessageBoxShell
- Parameters:
shellForChildren
-string
-string2
-strings
-
-
MessageBoxShell
@Deprecated public MessageBoxShell(org.eclipse.swt.widgets.Shell parent, String title, String text, String[] buttons, int defaultOption) Deprecated.ONLY FOR OLD EMP. DO NOT USE -
MessageBoxShell
-
MessageBoxShell
Open a messagebox using resource keys for title/text- Parameters:
style
- SWT styles for messageboxkeyPrefix
- message bundle key prefix used to get title and text. Title will be keyPrefix + ".title", and text will be set to keyPrefix + ".text"textParams
- any parameters for textparent
- Parent shell for messagebox
-
MessageBoxShell
Open a messagebox with actual title and text- Parameters:
style
-title
-text
-parent
-
-
-
Method Details
-
open
-
isOpen
public static boolean isOpen() -
setDefaultButtonUsingStyle
public void setDefaultButtonUsingStyle(int defaultStyle) -
open
Deprecated.ONLY FOR OLD EMP. DO NOT USE.- Returns:
-
open
Description copied from interface:UIFunctionsUserPrompter
Opens the prompt. returns when user has chosen an action, or auto-close- Specified by:
open
in interfaceUIFunctionsUserPrompter
-
triggerResultListener
private void triggerResultListener(int returnVal) -
getButtonVal
private int getButtonVal(int buttonPos) -
getButtonPos
private int getButtonPos(int buttonVal) -
open
private void open(boolean useCustomShell) -
_open
private void _open() -
createTextBox
private org.eclipse.swt.widgets.Control createTextBox(org.eclipse.swt.widgets.Composite textComposite, String text2) - Parameters:
textComposite
-text2
-- Returns:
-
createLinkLabel
private org.eclipse.swt.widgets.Canvas createLinkLabel(org.eclipse.swt.widgets.Composite shell, String text) -
getHtml
Description copied from interface:UIFunctionsUserPrompter
Returns the HTML that will be displayed along with the promptTODO: Create a boolean canHandleHTML()
- Specified by:
getHtml
in interfaceUIFunctionsUserPrompter
- Returns:
-
setHtml
- Specified by:
setHtml
in interfaceUIFunctionsUserPrompter
- Parameters:
html
-
-
setUrl
- Specified by:
setUrl
in interfaceUIFunctionsUserPrompter
- Parameters:
url
-
-
setSize
public void setSize(int width, int height) -
getRememberID
Description copied from interface:UIFunctionsUserPrompter
Retrieves the Remember ID associated with this prompt- Specified by:
getRememberID
in interfaceUIFunctionsUserPrompter
- Returns:
- the rememberID
-
setRemember
- Specified by:
setRemember
in interfaceUIFunctionsUserPrompter
- Parameters:
rememberID
-rememberByDefault
-rememberText
- null if you want the default
-
getRememberText
Description copied from interface:UIFunctionsUserPrompter
Retrieves the text to be displayed by the "Remember this Action" checkbox- Specified by:
getRememberText
in interfaceUIFunctionsUserPrompter
- Returns:
- the rememberText
-
setRememberText
- Specified by:
setRememberText
in interfaceUIFunctionsUserPrompter
- Parameters:
rememberText
- the rememberText to set
-
getAutoCloseInMS
public int getAutoCloseInMS()Description copied from interface:UIFunctionsUserPrompter
Returns the number milliseconds the prompt will wait around until it auto closes. Timer starts after the user is prompted (wheninvalid reference
#open()
- Specified by:
getAutoCloseInMS
in interfaceUIFunctionsUserPrompter
- Returns:
- the autoCloseInMS
-
setAutoCloseInMS
public void setAutoCloseInMS(int autoCloseInMS) Description copied from interface:UIFunctionsUserPrompter
Sets the # of milliseconds before auto closing. Timer starts after the user is prompted (wheninvalid reference
#open()
- Specified by:
setAutoCloseInMS
in interfaceUIFunctionsUserPrompter
- Parameters:
autoCloseInMS
- the autoCloseInMS to set
-
setSquish
public void setSquish(boolean b) -
isAutoClosed
public boolean isAutoClosed()Description copied from interface:UIFunctionsUserPrompter
Determines if the prompt was auto closed afterinvalid reference
#open()
- Specified by:
isAutoClosed
in interfaceUIFunctionsUserPrompter
- Returns:
- the autoClosed
-
setModal
public void setModal(boolean m) Only use this if you REALLY know what you're doing as in general it is a bad thing - check comments in this class- Parameters:
m
-
-
setRelatedObject
- Specified by:
setRelatedObject
in interfaceUIFunctionsUserPrompter
- Parameters:
relatedObject
-
-
setRelatedObjects
- Specified by:
setRelatedObjects
in interfaceUIFunctionsUserPrompter
-
getRelatedObjects
-
getLeftImage
- Returns:
- Since:
- 4.0.0.1
-
setLeftImage
public void setLeftImage(org.eclipse.swt.graphics.Image imgLeft) -
setLeftImage
public void setLeftImage(int icon) Replaces Image on left with icon- Parameters:
icon
- SWT.ICON_ERROR, ICON_INFORMATION, ICON_QUESTION, ICON_WARNING, ICON_WORKING- Since:
- 3.0.1.7
-
setIconResource
- Specified by:
setIconResource
in interfaceUIFunctionsUserPrompter
- Parameters:
resource
- image repository resource name (e.g. "error", "warning", "info")
-
main
-
getRememberOnlyIfButton
public int getRememberOnlyIfButton() -
setRememberOnlyIfButton
public void setRememberOnlyIfButton(int rememberOnlyIfButton) - Specified by:
setRememberOnlyIfButton
in interfaceUIFunctionsUserPrompter
- Parameters:
rememberOnlyIfButton
-
-
getUrlColor
public org.eclipse.swt.graphics.Color getUrlColor() -
setBrowserFollowLinks
public void setBrowserFollowLinks(boolean follow) -
setUrlColor
public void setUrlColor(org.eclipse.swt.graphics.Color colorURL) -
setHandleHTML
public void setHandleHTML(boolean handleHTML) - Parameters:
b
-- Since:
- 3.0.5.3
-
isRemembered
public boolean isRemembered() -
waitUntilClosed
public int waitUntilClosed()NOT RECOMMENDED!TODO: Occasionaly inspect list of callers and make them use
UserPrompterResultListener
if possible- Specified by:
waitUntilClosed
in interfaceUIFunctionsUserPrompter
-
getResult
public int getResult() -
swtButtonStylesToText
-
getButtons
-
setButtons
-
setButtons
-
addCheckBox
Adds a checkbox to the message box. Currently only one checkbox can be made via this method. -
getCheckBoxEnabled
public boolean getCheckBoxEnabled() -
setApplyToAllEnabled
public void setApplyToAllEnabled() -
getApplyToAll
public boolean getApplyToAll() -
getParent
public org.eclipse.swt.widgets.Shell getParent() -
setParent
public void setParent(org.eclipse.swt.widgets.Shell parent) -
close
public void close() -
setUseTextBox
public void setUseTextBox(boolean useTextBox) - Parameters:
useTextBox
- The useTextBox to set.
-
useTextBox
public boolean useTextBox()- Returns:
- Returns the useTextBox.
-
setLeftImage
-
setOneInstanceOf
Description copied from interface:UIFunctionsUserPrompter
Prevent more than one dialog of instanceID from showing up at once- Specified by:
setOneInstanceOf
in interfaceUIFunctionsUserPrompter
- Parameters:
instanceID
-
-