Package com.biglybt.ui.swt.shells
Class MessageSlideShell
- java.lang.Object
-
- com.biglybt.ui.swt.shells.MessageSlideShell
-
public class MessageSlideShell extends java.lang.Object
+=====================================+ | +----+ | | |Icon| Big Bold Title | | +----+ | | Wrapping message text | | with optional URL links | | +-----+ | | |BGImg| XX more slideys.. | | | Icon| Closing in XX secs | | +-----+ [HideAll] [Details] [Hide] | +=====================================+
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageSlideShell.PopupParams
-
Field Summary
Fields Modifier and Type Field Description private boolean
bDelayPaused
paused state of auto-close delayprivate org.eclipse.swt.widgets.Button
btnHideAll
Button that hides all slideys in the popupList.private org.eclipse.swt.widgets.Button
btnNext
Button to move to next message.private org.eclipse.swt.graphics.Color
colorFG
protected org.eclipse.swt.graphics.Color
colorURL
private org.eclipse.swt.widgets.Composite
cShell
Composite in shellprivate static int
currentPopupIndex
Current popup being displayedprivate static boolean
DEBUG
private static int
DETAILS_HEIGHT
Height of the details shellprivate static int
DETAILS_WIDTH
Width of the details shellprivate java.util.ArrayList<java.lang.Object>
disposeList
List of SWT objects needing disposalprivate static int
EDGE_GAP
Slide until there's this much gap between shell and edge of screenprivate static int
firstUnreadMessage
Index of first message which the user has not seen (index) - set to -1 if we don't care.private static java.util.ArrayList<MessageSlideShell.PopupParams>
historyList
List of all popups ever createdprivate int
idxHistory
Position this popup is in the history listprivate org.eclipse.swt.widgets.Label
lblCloseIn
popup could and closing in xx seconds labelprivate static AEMonitor
monitor
Synchronization for popupListprivate java.lang.String
sDetails
Text to put into details popupprivate org.eclipse.swt.widgets.Shell
shell
Shell for popupprivate static int
SHELL_DEF_WIDTH
Width used when BG image can't be loadedprivate static int
SHELL_MAX_HEIGHT
Maximimum height of popup.private static int
SHELL_MIN_HEIGHT
Standard height of the shell.
-
Constructor Summary
Constructors Modifier Constructor Description MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String keyPrefix, java.lang.String details, java.lang.String[] textParams, int timeoutSecs)
Open a popup using resource keys for title/textMessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String keyPrefix, java.lang.String details, java.lang.String[] textParams, java.lang.Object[] relatedObjects, int timeoutSecs)
MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String title, java.lang.String text, java.lang.String details, int timeoutSecs)
MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String title, java.lang.String text, java.lang.String details, java.lang.Object[] relatedObjects, int timeoutSecs)
Open Mr Slideyprivate
MessageSlideShell(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams popupParams, boolean bSlide)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addMouseTrackListener(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.events.MouseTrackListener listener)
Adds mousetracklistener to composite and all it's childrenprivate static void
addToHistory(MessageSlideShell.PopupParams popupParams)
private void
create(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams popupParams, boolean bSlide)
private void
createLinkLabel(org.eclipse.swt.widgets.Composite shell, MessageSlideShell.PopupParams popupParams)
static void
displayLastMessage(org.eclipse.swt.widgets.Display display, boolean last_unread)
private void
disposeShell(org.eclipse.swt.widgets.Shell shell)
org.eclipse.swt.graphics.Color
getColorFG()
org.eclipse.swt.graphics.Color
getUrlColor()
static void
main(java.lang.String[] args)
Teststatic void
recordMessage(int iconID, java.lang.String title, java.lang.String text, java.lang.String details, java.lang.Object[] relatedTo, int timeoutSecs)
Adds this message to the slide shell without forcing it to be displayed.private void
removeMouseTrackListener(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.events.MouseTrackListener listener)
removes mousetracklistener from composite and all it's childrenprivate void
runPopup(org.eclipse.swt.graphics.Rectangle endBounds, int idx, boolean bSlide, int timeoutSecs)
Start the slid in, wait specified time while notifying user of impending auto-close, then slide out.private void
setButtonNextText(int numAfter)
void
setColorFG(org.eclipse.swt.graphics.Color colorFG)
void
setUrlColor(org.eclipse.swt.graphics.Color urlColor)
private void
showPopup(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams item, boolean bSlide)
Show the popup with the specified parameters.static void
test(org.eclipse.swt.widgets.Display display)
static void
waitUntilClosed()
Waits until all slideys are closed before returning to caller.
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
EDGE_GAP
private static final int EDGE_GAP
Slide until there's this much gap between shell and edge of screen- See Also:
- Constant Field Values
-
SHELL_DEF_WIDTH
private static final int SHELL_DEF_WIDTH
Width used when BG image can't be loaded- See Also:
- Constant Field Values
-
SHELL_MIN_HEIGHT
private static final int SHELL_MIN_HEIGHT
Standard height of the shell. Shell may grow depending on text- See Also:
- Constant Field Values
-
SHELL_MAX_HEIGHT
private static final int SHELL_MAX_HEIGHT
Maximimum height of popup. If text is too long, the full text will be put into details.- See Also:
- Constant Field Values
-
DETAILS_WIDTH
private static final int DETAILS_WIDTH
Width of the details shell- See Also:
- Constant Field Values
-
DETAILS_HEIGHT
private static final int DETAILS_HEIGHT
Height of the details shell- See Also:
- Constant Field Values
-
monitor
private static final AEMonitor monitor
Synchronization for popupList
-
historyList
private static java.util.ArrayList<MessageSlideShell.PopupParams> historyList
List of all popups ever created
-
currentPopupIndex
private static int currentPopupIndex
Current popup being displayed
-
firstUnreadMessage
private static int firstUnreadMessage
Index of first message which the user has not seen (index) - set to -1 if we don't care. :)
-
shell
private org.eclipse.swt.widgets.Shell shell
Shell for popup
-
cShell
private org.eclipse.swt.widgets.Composite cShell
Composite in shell
-
lblCloseIn
private org.eclipse.swt.widgets.Label lblCloseIn
popup could and closing in xx seconds label
-
btnHideAll
private org.eclipse.swt.widgets.Button btnHideAll
Button that hides all slideys in the popupList. Visible only when there's more than 1 slidey
-
btnNext
private org.eclipse.swt.widgets.Button btnNext
Button to move to next message. Text changes from "Hide" to "Next" appropriately.
-
bDelayPaused
private boolean bDelayPaused
paused state of auto-close delay
-
disposeList
private java.util.ArrayList<java.lang.Object> disposeList
List of SWT objects needing disposal
-
sDetails
private java.lang.String sDetails
Text to put into details popup
-
idxHistory
private int idxHistory
Position this popup is in the history list
-
colorURL
protected org.eclipse.swt.graphics.Color colorURL
-
colorFG
private org.eclipse.swt.graphics.Color colorFG
-
-
Constructor Detail
-
MessageSlideShell
public MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String keyPrefix, java.lang.String details, java.lang.String[] textParams, int timeoutSecs)
Open a popup using resource keys for title/text- Parameters:
display
- Display to create the shell oniconID
- SWT.ICON_* constant for icon in top leftkeyPrefix
- message bundle key prefix used to get title and text. Title will be keyPrefix + ".title", and text will be set to keyPrefix + ".text"details
- actual text for details (not a key)textParams
- any parameters for text
-
MessageSlideShell
public MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String keyPrefix, java.lang.String details, java.lang.String[] textParams, java.lang.Object[] relatedObjects, int timeoutSecs)
- Parameters:
display
-iconID
-keyPrefix
-details
-textParams
-relatedObjects
-timeoutSecs
- = -1 -> use default timeout, 0 -> no timeout, other -> timeout in secs
-
MessageSlideShell
public MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String title, java.lang.String text, java.lang.String details, int timeoutSecs)
-
MessageSlideShell
public MessageSlideShell(org.eclipse.swt.widgets.Display display, int iconID, java.lang.String title, java.lang.String text, java.lang.String details, java.lang.Object[] relatedObjects, int timeoutSecs)
Open Mr Slidey- Parameters:
display
- Display to create the shell oniconID
- SWT.ICON_* constant for icon in top lefttitle
- Text to put in the titletext
- Text to put in the bodydetails
- Text displayed when the Details button is pressed. Null for disabled Details button.timeoutSecs
- = -1 -> use default timeout, 0 -> no timeout, other -> timeout in secs
-
MessageSlideShell
private MessageSlideShell(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams popupParams, boolean bSlide)
-
-
Method Detail
-
addToHistory
private static void addToHistory(MessageSlideShell.PopupParams popupParams)
- Parameters:
popupParams
-- Since:
- 4.1.0.5
-
displayLastMessage
public static void displayLastMessage(org.eclipse.swt.widgets.Display display, boolean last_unread)
-
recordMessage
public static void recordMessage(int iconID, java.lang.String title, java.lang.String text, java.lang.String details, java.lang.Object[] relatedTo, int timeoutSecs)
Adds this message to the slide shell without forcing it to be displayed.- Parameters:
relatedTo
-
-
create
private void create(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams popupParams, boolean bSlide)
-
createLinkLabel
private void createLinkLabel(org.eclipse.swt.widgets.Composite shell, MessageSlideShell.PopupParams popupParams)
- Parameters:
shell2
-b
-- Since:
- 3.0.0.9
-
setButtonNextText
private void setButtonNextText(int numAfter)
- Parameters:
numAfter
-
-
showPopup
private void showPopup(org.eclipse.swt.widgets.Display display, MessageSlideShell.PopupParams item, boolean bSlide)
Show the popup with the specified parameters.- Parameters:
display
- Display to show onitem
- popup to display. Must already exist in historyListbSlide
- Whether to slide in or show immediately
-
addMouseTrackListener
private void addMouseTrackListener(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.events.MouseTrackListener listener)
Adds mousetracklistener to composite and all it's children- Parameters:
parent
- Composite to start atlistener
- Listener to add
-
removeMouseTrackListener
private void removeMouseTrackListener(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.events.MouseTrackListener listener)
removes mousetracklistener from composite and all it's children- Parameters:
parent
- Composite to start atlistener
- Listener to remove
-
runPopup
private void runPopup(org.eclipse.swt.graphics.Rectangle endBounds, int idx, boolean bSlide, int timeoutSecs)
Start the slid in, wait specified time while notifying user of impending auto-close, then slide out. Run on separate thread, so this method returns immediately- Parameters:
endBounds
- end location and size wantedidx
- Index in historyList of popup (Used to calculate # prev, next)bSlide
- Whether to slide in, or show immediately
-
disposeShell
private void disposeShell(org.eclipse.swt.widgets.Shell shell)
-
waitUntilClosed
public static void waitUntilClosed()
Waits until all slideys are closed before returning to caller.
-
main
public static void main(java.lang.String[] args)
Test- Parameters:
args
-
-
test
public static void test(org.eclipse.swt.widgets.Display display)
-
getUrlColor
public org.eclipse.swt.graphics.Color getUrlColor()
-
setUrlColor
public void setUrlColor(org.eclipse.swt.graphics.Color urlColor)
-
getColorFG
public org.eclipse.swt.graphics.Color getColorFG()
-
setColorFG
public void setColorFG(org.eclipse.swt.graphics.Color colorFG)
-
-