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 Object
implements UIFunctionsUserPrompter

A messagebox that allows you config the button


Field Summary
protected  boolean isRemembered
           
static String STATUS_TEXT_CLOSE
           
protected  org.eclipse.swt.graphics.Color urlColor
           
 
Constructor Summary
MessageBoxShell(int style, String title, String text)
          Open a messagebox with actual title and text
MessageBoxShell(int style, String keyPrefix, String[] textParams)
          Open a messagebox using resource keys for title/text
MessageBoxShell(org.eclipse.swt.widgets.Shell parent, String title, String text, String[] buttons, int defaultOption)
          Deprecated. 
MessageBoxShell(String title, String text)
           
MessageBoxShell(String title, String text, String[] buttons, int defaultOption)
           
 
Method Summary
 void addCheckBox(String cbMessageID, int cbMinUserMode, boolean defaultOn)
           
 void close()
           
 int getAutoCloseInMS()
          Returns the number milliseconds the prompt will wait around until it auto closes.
 String[] getButtons()
           
 boolean getCheckBoxEnabled()
           
 String getHtml()
          Returns the HTML that will be displayed along with the prompt
 Object getLeftImage()
           
 org.eclipse.swt.widgets.Shell getParent()
           
 Object[] getRelatedObjects()
           
 String getRememberID()
          Retrieves the Remember ID associated with this prompt
 int getRememberOnlyIfButton()
           
 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(String[] args)
           
 int open()
          Deprecated. 
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 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, String[] buttons, Integer[] buttonVals)
           
 void setButtons(String[] buttons)
           
 void setDefaultButtonUsingStyle(int defaultStyle)
           
 void setHandleHTML(boolean handleHTML)
           
 void setHtml(String html)
           
 void setIconResource(String resource)
           
 void setLeftImage(org.eclipse.swt.graphics.Image imgLeft)
           
 void setLeftImage(int icon)
          Replaces Image on left with icon
 void setLeftImage(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(String instanceID)
          Prevent more than one dialog of instanceID from showing up at once
 void 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 setUrl(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 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(String title,
                       String text,
                       String[] buttons,
                       int defaultOption)
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

public MessageBoxShell(String title,
                       String text)

MessageBoxShell

public MessageBoxShell(int style,
                       String keyPrefix,
                       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,
                       String title,
                       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,
                        String title,
                        String text,
                        String[] buttons,
                        int defaultOption,
                        String rememberID,
                        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 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(String html)
Specified by:
setHtml in interface UIFunctionsUserPrompter

setUrl

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

setSize

public void setSize(int width,
                    int height)

getRememberID

public 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(String rememberID,
                        boolean rememberByDefault,
                        String rememberText)
Specified by:
setRemember in interface UIFunctionsUserPrompter
Parameters:
rememberID -
rememberByDefault -
rememberText - null if you want the default

getRememberText

public 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(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(Object relatedObject)
Specified by:
setRelatedObject in interface UIFunctionsUserPrompter

setRelatedObjects

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

getRelatedObjects

public Object[] getRelatedObjects()

getLeftImage

public 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(String resource)
Specified by:
setIconResource in interface UIFunctionsUserPrompter
Parameters:
resource - image repository resource name (e.g. "error", "warning", "info")

main

public static void main(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 String[] getButtons()

setButtons

public void setButtons(String[] buttons)

setButtons

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

addCheckBox

public void addCheckBox(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(String id)

setOneInstanceOf

public void setOneInstanceOf(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