org.gudy.azureus2.ui.swt.shells
Class MessageBoxShell

java.lang.Object
  extended by org.gudy.azureus2.ui.swt.shells.MessageBoxShell
All Implemented Interfaces:
UIFunctionsUserPrompter

public class MessageBoxShell
extends java.lang.Object
implements UIFunctionsUserPrompter

A messagebox that allows you config the button


Field Summary
protected  boolean isRemembered
           
static java.lang.String STATUS_TEXT_CLOSE
           
protected  org.eclipse.swt.graphics.Color urlColor
           
 
Constructor Summary
MessageBoxShell(int style, java.lang.String title, java.lang.String text)
          Open a messagebox with actual title and text
MessageBoxShell(int style, java.lang.String keyPrefix, java.lang.String[] textParams)
          Open a messagebox using resource keys for title/text
MessageBoxShell(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String text, java.lang.String[] buttons, int defaultOption)
          Deprecated. 
MessageBoxShell(java.lang.String title, java.lang.String text)
           
MessageBoxShell(java.lang.String title, java.lang.String text, java.lang.String[] buttons, int defaultOption)
           
 
Method Summary
 void addCheckBox(java.lang.String cbMessageID, int cbMinUserMode, boolean defaultOn)
           
 void close()
           
 int getAutoCloseInMS()
          Returns the number milliseconds the prompt will wait around until it auto closes.
 java.lang.String[] getButtons()
           
 boolean getCheckBoxEnabled()
           
 java.lang.String getHtml()
          Returns the HTML that will be displayed along with the prompt
 java.lang.Object getLeftImage()
           
 org.eclipse.swt.widgets.Shell getParent()
           
 java.lang.Object[] getRelatedObjects()
           
 java.lang.String getRememberID()
          Retrieves the Remember ID associated with this prompt
 int getRememberOnlyIfButton()
           
 java.lang.String getRememberText()
          Retrieves the text to be displayed by the "Remember this Action" checkbox
 int getResult()
           
 org.eclipse.swt.graphics.Color getUrlColor()
           
 boolean isAutoClosed()
          Determines if the prompt was auto closed after #open() was called, or if the user chose an option.
static boolean isOpen()
           
 boolean isRemembered()
           
static void main(java.lang.String[] args)
           
 int open()
          Deprecated. 
static void open(org.eclipse.swt.widgets.Shell parent, java.lang.String title, java.lang.String text, java.lang.String[] buttons, int defaultOption, java.lang.String rememberID, java.lang.String rememberText, boolean bRememberByDefault, int autoCloseInMS, UserPrompterResultListener l)
           
 void open(UserPrompterResultListener l)
          Opens the prompt.
 void setAutoCloseInMS(int autoCloseInMS)
          Sets the # of milliseconds before auto closing.
 void setBrowserFollowLinks(boolean follow)
           
 void setButtons(int defaltButtonPos, java.lang.String[] buttons, java.lang.Integer[] buttonVals)
           
 void setButtons(java.lang.String[] buttons)
           
 void setDefaultButtonUsingStyle(int defaultStyle)
           
 void setHandleHTML(boolean handleHTML)
           
 void setHtml(java.lang.String html)
           
 void setIconResource(java.lang.String resource)
           
 void setLeftImage(org.eclipse.swt.graphics.Image imgLeft)
           
 void setLeftImage(int icon)
          Replaces Image on left with icon
 void setLeftImage(java.lang.String id)
           
 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
 void setOneInstanceOf(java.lang.String instanceID)
          Prevent more than one dialog of instanceID from showing up at once
 void setParent(org.eclipse.swt.widgets.Shell parent)
           
 void setRelatedObject(java.lang.Object relatedObject)
           
 void setRelatedObjects(java.lang.Object[] relatedObjects)
           
 void setRemember(java.lang.String rememberID, boolean rememberByDefault, java.lang.String rememberText)
           
 void setRememberOnlyIfButton(int rememberOnlyIfButton)
           
 void setRememberText(java.lang.String rememberText)
           
 void setSize(int width, int height)
           
 void setSquish(boolean b)
           
 void setUrl(java.lang.String url)
           
 void setUrlColor(org.eclipse.swt.graphics.Color colorURL)
           
 void setUseTextBox(boolean useTextBox)
           
 boolean useTextBox()
           
 int waitUntilClosed()
          NOT RECOMMENDED!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_TEXT_CLOSE

public static final java.lang.String STATUS_TEXT_CLOSE
See Also:
Constant Field Values

urlColor

protected org.eclipse.swt.graphics.Color urlColor

isRemembered

protected boolean isRemembered
Constructor Detail

MessageBoxShell

public MessageBoxShell(java.lang.String title,
                       java.lang.String text,
                       java.lang.String[] buttons,
                       int defaultOption)
Parameters:
shellForChildren -
string -
string2 -
strings -

MessageBoxShell

@Deprecated
public MessageBoxShell(org.eclipse.swt.widgets.Shell parent,
                                  java.lang.String title,
                                  java.lang.String text,
                                  java.lang.String[] buttons,
                                  int defaultOption)
Deprecated. 

ONLY FOR OLD EMP. DO NOT USE


MessageBoxShell

public MessageBoxShell(java.lang.String title,
                       java.lang.String text)

MessageBoxShell

public MessageBoxShell(int style,
                       java.lang.String keyPrefix,
                       java.lang.String[] textParams)
Open a messagebox using resource keys for title/text

Parameters:
parent - Parent shell for messagebox
style - SWT styles for messagebox
keyPrefix - 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 text

MessageBoxShell

public MessageBoxShell(int style,
                       java.lang.String title,
                       java.lang.String text)
Open a messagebox with actual title and text

Parameters:
parent -
style -
title -
text -
Method Detail

open

public static void open(org.eclipse.swt.widgets.Shell parent,
                        java.lang.String title,
                        java.lang.String text,
                        java.lang.String[] buttons,
                        int defaultOption,
                        java.lang.String rememberID,
                        java.lang.String rememberText,
                        boolean bRememberByDefault,
                        int autoCloseInMS,
                        UserPrompterResultListener l)

isOpen

public static boolean isOpen()

setDefaultButtonUsingStyle

public void setDefaultButtonUsingStyle(int defaultStyle)

open

@Deprecated
public int open()
Deprecated. 

ONLY FOR OLD EMP. DO NOT USE.

Use open(UserPrompterResultListener)

Returns:

open

public void open(UserPrompterResultListener l)
Description copied from interface: UIFunctionsUserPrompter
Opens the prompt. returns when user has chosen an action, or auto-close

Specified by:
open in interface UIFunctionsUserPrompter

getHtml

public java.lang.String getHtml()
Description copied from interface: UIFunctionsUserPrompter
Returns the HTML that will be displayed along with the prompt

TODO: Create a boolean canHandleHTML()

Specified by:
getHtml in interface UIFunctionsUserPrompter
Returns:

setHtml

public void setHtml(java.lang.String html)
Specified by:
setHtml in interface UIFunctionsUserPrompter

setUrl

public void setUrl(java.lang.String url)
Specified by:
setUrl in interface UIFunctionsUserPrompter

setSize

public void setSize(int width,
                    int height)

getRememberID

public java.lang.String getRememberID()
Description copied from interface: UIFunctionsUserPrompter
Retrieves the Remember ID associated with this prompt

Specified by:
getRememberID in interface UIFunctionsUserPrompter
Returns:
the rememberID

setRemember

public void setRemember(java.lang.String rememberID,
                        boolean rememberByDefault,
                        java.lang.String rememberText)
Specified by:
setRemember in interface UIFunctionsUserPrompter
Parameters:
rememberID -
rememberByDefault -
rememberText - null if you want the default

getRememberText

public java.lang.String getRememberText()
Description copied from interface: UIFunctionsUserPrompter
Retrieves the text to be displayed by the "Remember this Action" checkbox

Specified by:
getRememberText in interface UIFunctionsUserPrompter
Returns:
the rememberText

setRememberText

public void setRememberText(java.lang.String rememberText)
Specified by:
setRememberText in interface UIFunctionsUserPrompter
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 (when #open() is called), and typically does not decrease while the user is viewing the prompt (certain implementations may operate differently)

Specified by:
getAutoCloseInMS in interface UIFunctionsUserPrompter
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 (when #open() is called), and typically does not decrease while the user is viewing the prompt (certain implementations may operate differently)

Specified by:
setAutoCloseInMS in interface UIFunctionsUserPrompter
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 after #open() was called, or if the user chose an option.

Specified by:
isAutoClosed in interface UIFunctionsUserPrompter
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

public void setRelatedObject(java.lang.Object relatedObject)
Specified by:
setRelatedObject in interface UIFunctionsUserPrompter

setRelatedObjects

public void setRelatedObjects(java.lang.Object[] relatedObjects)
Specified by:
setRelatedObjects in interface UIFunctionsUserPrompter

getRelatedObjects

public java.lang.Object[] getRelatedObjects()

getLeftImage

public java.lang.Object 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

public void setIconResource(java.lang.String resource)
Specified by:
setIconResource in interface UIFunctionsUserPrompter
Parameters:
resource - image repository resource name (e.g. "error", "warning", "info")

main

public static void main(java.lang.String[] args)

getRememberOnlyIfButton

public int getRememberOnlyIfButton()

setRememberOnlyIfButton

public void setRememberOnlyIfButton(int rememberOnlyIfButton)
Specified by:
setRememberOnlyIfButton in interface UIFunctionsUserPrompter

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 interface UIFunctionsUserPrompter

getResult

public int getResult()

getButtons

public java.lang.String[] getButtons()

setButtons

public void setButtons(java.lang.String[] buttons)

setButtons

public void setButtons(int defaltButtonPos,
                       java.lang.String[] buttons,
                       java.lang.Integer[] buttonVals)

addCheckBox

public void addCheckBox(java.lang.String cbMessageID,
                        int cbMinUserMode,
                        boolean defaultOn)

getCheckBoxEnabled

public boolean getCheckBoxEnabled()

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

public void setLeftImage(java.lang.String id)

setOneInstanceOf

public void setOneInstanceOf(java.lang.String instanceID)
Description copied from interface: UIFunctionsUserPrompter
Prevent more than one dialog of instanceID from showing up at once

Specified by:
setOneInstanceOf in interface UIFunctionsUserPrompter