eu.livotov.tpt.gui.dialogs
Class DownloadDialog

java.lang.Object
  extended by com.vaadin.ui.AbstractComponent
      extended by com.vaadin.ui.AbstractComponentContainer
          extended by com.vaadin.ui.Panel
              extended by com.vaadin.ui.Window
                  extended by eu.livotov.tpt.gui.windows.TPTWindow
                      extended by eu.livotov.tpt.gui.dialogs.AbstractDialog
                          extended by eu.livotov.tpt.gui.dialogs.DownloadDialog
All Implemented Interfaces:
com.vaadin.event.Action.Container, com.vaadin.event.Action.Handler, com.vaadin.event.Action.Notifier, com.vaadin.event.MethodEventSource, com.vaadin.terminal.Paintable, com.vaadin.terminal.ParameterHandler, com.vaadin.terminal.Scrollable, com.vaadin.terminal.Sizeable, com.vaadin.terminal.URIHandler, com.vaadin.terminal.VariableOwner, com.vaadin.ui.Button.ClickListener, com.vaadin.ui.Component, com.vaadin.ui.ComponentContainer, com.vaadin.ui.ComponentContainer.ComponentAttachListener, com.vaadin.ui.ComponentContainer.ComponentDetachListener, com.vaadin.ui.Window.CloseListener, java.io.Serializable, java.util.EventListener

public class DownloadDialog
extends AbstractDialog
implements com.vaadin.ui.Button.ClickListener

A modal dialog that shows a title, informational message and a link to a file or resource, that can be clicked by the used and downloaded. Dialog also provides the "Close" button to be closed as well as reacts for ENTER and ESC keys. Dialog does not provide any result but just an event that it was closed.

See Also:
Serialized Form

Nested Class Summary
static interface DownloadDialog.DownloadDialogResultListener
          Dialog close event listener interface
 
Nested classes/interfaces inherited from class com.vaadin.ui.Window
com.vaadin.ui.Window.CloseEvent, com.vaadin.ui.Window.CloseListener, com.vaadin.ui.Window.CloseShortcut, com.vaadin.ui.Window.Notification, com.vaadin.ui.Window.ResizeEvent, com.vaadin.ui.Window.ResizeListener
 
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponent.ComponentErrorEvent, com.vaadin.ui.AbstractComponent.ComponentErrorHandler
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.URIHandler
com.vaadin.terminal.URIHandler.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.ParameterHandler
com.vaadin.terminal.ParameterHandler.ErrorEvent
 
Nested classes/interfaces inherited from interface com.vaadin.ui.ComponentContainer
com.vaadin.ui.ComponentContainer.ComponentAttachEvent, com.vaadin.ui.ComponentContainer.ComponentAttachListener, com.vaadin.ui.ComponentContainer.ComponentDetachEvent, com.vaadin.ui.ComponentContainer.ComponentDetachListener
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.ErrorListener, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.terminal.Paintable
com.vaadin.terminal.Paintable.RepaintRequestEvent, com.vaadin.terminal.Paintable.RepaintRequestListener
 
Field Summary
protected  DownloadDialogButtonsComponent buttonsArea
           
protected  DownloadDialog.DownloadDialogResultListener resultReceiver
           
 
Fields inherited from class eu.livotov.tpt.gui.dialogs.AbstractDialog
parentWindow
 
Fields inherited from class com.vaadin.ui.Window
BORDER_DEFAULT, BORDER_MINIMAL, BORDER_NONE, closeShortcut
 
Fields inherited from class com.vaadin.ui.Panel
actionManager, STYLE_LIGHT
 
Fields inherited from interface com.vaadin.terminal.Sizeable
SIZE_UNDEFINED, UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
DownloadDialog(com.vaadin.Application app)
          Constructs new dialog instance.
DownloadDialog(com.vaadin.ui.Window parent)
          Constructs new dialog instance.
 
Method Summary
 void buttonClick(com.vaadin.ui.Button.ClickEvent clickEvent)
          Simulates "Close" button click to close the dialog.
 void enterKeyPressed()
          Called when user presses an ENTER key
 void escapeKeyPressed()
          Called when user presses an ESC key
protected  void finishDialog()
           
private  void initActions()
           
private  void initUI()
           
 void showDialog()
           
 void showDownloadDialog(java.lang.String title, java.lang.String message, java.io.File target, java.lang.String targetName, DownloadDialog.DownloadDialogResultListener resultListener)
          Displays the dialog, blocking the parent window.
 void showDownloadDialog(java.lang.String title, java.lang.String message, com.vaadin.terminal.Resource target, java.lang.String targetName, DownloadDialog.DownloadDialogResultListener resultListener)
          Displays the dialog, blocking the parent window.
 void windowClose(com.vaadin.ui.Window.CloseEvent closeEvent)
          Called when window is closed by pressing a close icon at the top-right corner.
 
Methods inherited from class eu.livotov.tpt.gui.dialogs.AbstractDialog
hideDialog
 
Methods inherited from class eu.livotov.tpt.gui.windows.TPTWindow
applyHtmlFormatting, getActions, getURL, handleAction, showErrorMessage, showMessage, showNotification, showWarningMessage
 
Methods inherited from class com.vaadin.ui.Window
addComponent, addListener, addListener, addParameterHandler, addURIHandler, addWindow, center, changeVariables, close, executeJavaScript, fireClose, fireResize, getApplication, getBorder, getChildWindows, getName, getParent, getPositionX, getPositionY, getTerminal, getTheme, getWindow, handleParameters, handleURI, isClosable, isDraggable, isModal, isResizable, open, open, open, paintContent, removeCloseShortcut, removeListener, removeListener, removeParameterHandler, removeURIHandler, removeWindow, setApplication, setBorder, setClosable, setCloseShortcut, setDraggable, setModal, setName, setParent, setPositionX, setPositionY, setResizable, setTerminal, setTheme, showNotification, showNotification, showNotification, showNotification, showNotification
 
Methods inherited from class com.vaadin.ui.Panel
addAction, addActionHandler, addListener, attach, componentAttachedToContainer, componentDetachedFromContainer, detach, getActionManager, getComponentIterator, getContent, getLayout, getScrollLeft, getScrollOffsetX, getScrollOffsetY, getScrollTop, isScrollable, removeAction, removeActionHandler, removeAllActionHandlers, removeAllComponents, removeComponent, removeListener, replaceComponent, requestRepaintAll, setContent, setLayout, setScrollable, setScrollLeft, setScrollOffsetX, setScrollOffsetY, setScrollTop
 
Methods inherited from class com.vaadin.ui.AbstractComponentContainer
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeListener, removeListener, setEnabled, setHeight, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addListener, addListener, addListener, addListener, addListener, addStyleName, childRequestedRepaint, fireComponentErrorEvent, fireComponentEvent, fireEvent, focus, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getLocale, getStyle, getStyleName, getTag, getWidth, getWidthUnits, handleError, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setErrorHandler, setHeight, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidth, setWidthUnits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, childRequestedRepaint, getCaption, getIcon, getLocale, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setReadOnly, setStyleName, setVisible
 
Methods inherited from interface com.vaadin.terminal.Paintable
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId
 
Methods inherited from interface com.vaadin.terminal.VariableOwner
isImmediate
 
Methods inherited from interface com.vaadin.terminal.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUnits
 

Field Detail

buttonsArea

protected DownloadDialogButtonsComponent buttonsArea

resultReceiver

protected DownloadDialog.DownloadDialogResultListener resultReceiver
Constructor Detail

DownloadDialog

public DownloadDialog(com.vaadin.Application app)
Constructs new dialog instance. This does not show the dialog. Use extra showXXX method for this.

Parameters:
app - application instance, that have a main window set and initialized.

DownloadDialog

public DownloadDialog(com.vaadin.ui.Window parent)
Constructs new dialog instance. This does not show the dialog. Use extra showXXX method for this.

Parameters:
parent - window, that will act as a parent for this dialog
Method Detail

initActions

private void initActions()

initUI

private void initUI()

showDownloadDialog

public void showDownloadDialog(java.lang.String title,
                               java.lang.String message,
                               com.vaadin.terminal.Resource target,
                               java.lang.String targetName,
                               DownloadDialog.DownloadDialogResultListener resultListener)
Displays the dialog, blocking the parent window.

Parameters:
title - dialog title
message - informational message
target - resource that represents the data to be downloaded
targetName - name of the resource, to be displayed as download link
resultListener - dialog close event listener, that is fired once dialog is closed by the user.

showDownloadDialog

public void showDownloadDialog(java.lang.String title,
                               java.lang.String message,
                               java.io.File target,
                               java.lang.String targetName,
                               DownloadDialog.DownloadDialogResultListener resultListener)
Displays the dialog, blocking the parent window. In order for this method to work, an Application must be associated with this dialog parent window, as in order to covert a File target into the ITMill resource, parent window's .getApplication() method will be called and must return not null.

Parameters:
title - dialog title
message - informational message
target - file (at the server side) that represents the data to be downloaded
targetName - name of the resource, to be displayed as download link
resultListener - dialog close event listener, that is fired once dialog is closed by the user.

buttonClick

public void buttonClick(com.vaadin.ui.Button.ClickEvent clickEvent)
Simulates "Close" button click to close the dialog.

Specified by:
buttonClick in interface com.vaadin.ui.Button.ClickListener
Parameters:
clickEvent -

finishDialog

protected void finishDialog()

windowClose

public void windowClose(com.vaadin.ui.Window.CloseEvent closeEvent)
Description copied from class: TPTWindow
Called when window is closed by pressing a close icon at the top-right corner.

Specified by:
windowClose in interface com.vaadin.ui.Window.CloseListener
Overrides:
windowClose in class TPTWindow
Parameters:
closeEvent - close event that came from toolkit

showDialog

public void showDialog()
Overrides:
showDialog in class AbstractDialog

enterKeyPressed

public void enterKeyPressed()
Description copied from class: TPTWindow
Called when user presses an ENTER key

Overrides:
enterKeyPressed in class TPTWindow

escapeKeyPressed

public void escapeKeyPressed()
Description copied from class: TPTWindow
Called when user presses an ESC key

Overrides:
escapeKeyPressed in class TPTWindow