eu.livotov.tpt.gui.windows
Class TPTWindow

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
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.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
Direct Known Subclasses:
AbstractDialog, TPTHtmlWindow

public class TPTWindow
extends com.vaadin.ui.Window
implements com.vaadin.event.Action.Handler, com.vaadin.ui.Window.CloseListener

Extends regular ITMill Window with some small but sometimes useful features, such as simplified methods for quick invoke of various types of notifications and so on. It also does all dirty job for registering action handlers for ENTER/ESC key presses listening. All you need is to override the corresponding method to catch the event. Use it just like you use regular Windows class.

See Also:
Serialized Form

Nested Class Summary
 
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
private  com.vaadin.event.Action[] actions
           
private  com.vaadin.event.Action enterKeyAction
           
private  com.vaadin.event.Action escapeKeyAction
           
 
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
TPTWindow()
           
TPTWindow(java.lang.String title)
           
 
Method Summary
static java.lang.String applyHtmlFormatting(java.lang.String text)
          Applys some html formatting to the specified text.
 void enterKeyPressed()
          Called when user presses an ENTER key
 void escapeKeyPressed()
          Called when user presses an ESC key
 com.vaadin.event.Action[] getActions(java.lang.Object o, java.lang.Object o1)
           
 java.net.URL getURL()
          Fixes the getURL() method in ITMill Toolkit Window class to avoid having slash "/" as the final url character.
 void handleAction(com.vaadin.event.Action action, java.lang.Object o, java.lang.Object o1)
           
 void showErrorMessage(java.lang.String title, java.lang.String info, boolean format)
          Shows error message to the user, using ITMill Toolkit notification mechanism.
 void showMessage(java.lang.String title, java.lang.String info, boolean format)
          Shows informational message to the user, using ITMill Toolkit notification mechanism.
 void showNotification(java.lang.String title, java.lang.String info, boolean format)
          Shows small tray (bottom-right corner) notification message to the user, using ITMill Toolkit notification mechanism.
 void showWarningMessage(java.lang.String title, java.lang.String info, boolean format)
          Shows warning message to the user, using ITMill Toolkit notification mechanism.
 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 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

enterKeyAction

private com.vaadin.event.Action enterKeyAction

escapeKeyAction

private com.vaadin.event.Action escapeKeyAction

actions

private com.vaadin.event.Action[] actions
Constructor Detail

TPTWindow

public TPTWindow()

TPTWindow

public TPTWindow(java.lang.String title)
Method Detail

showMessage

public void showMessage(java.lang.String title,
                        java.lang.String info,
                        boolean format)
Shows informational message to the user, using ITMill Toolkit notification mechanism. This is actually an equivalent of calling Window.showNotification method with the flag Window.Notification.TYPE_HUMANIZED_MESSAGE

Parameters:
title - message title
info - message text
format - set to true if you want your message only (not title) text be reformatted to make it html-based. Actually, reformat will replace all CR / CRLF codes to  <br> html tags in order to save line break formatting.

showErrorMessage

public void showErrorMessage(java.lang.String title,
                             java.lang.String info,
                             boolean format)
Shows error message to the user, using ITMill Toolkit notification mechanism. This is actually an equivalent of calling Window.showNotification method with the flag Window.Notification.TYPE_ERROR_MESSAGE

Parameters:
title - message title
info - message text
format - set to true if you want your message only (not title) text be reformatted to make it html-based. Actually, reformat will replace all CR / CRLF codes to  <br> html tags in order to save line break formatting.

showWarningMessage

public void showWarningMessage(java.lang.String title,
                               java.lang.String info,
                               boolean format)
Shows warning message to the user, using ITMill Toolkit notification mechanism. This is actually an equivalent of calling Window.showNotification method with the flag Window.Notification.TYPE_WARNING_MESSAGE

Parameters:
title - message title
info - message text
format - set to true if you want your message only (not title) text be reformatted to make it html-based. Actually, reformat will replace all CR / CRLF codes to  <br> html tags in order to save line break formatting.

showNotification

public void showNotification(java.lang.String title,
                             java.lang.String info,
                             boolean format)
Shows small tray (bottom-right corner) notification message to the user, using ITMill Toolkit notification mechanism. This is actually an equivalent of calling Window.showNotification method with the flag Window.Notification.TYPE_TRAY_NOTIFICATION

Parameters:
title - message title
info - message text
format - set to true if you want your message only (not title) text be reformatted to make it html-based. Actually, reformat will replace all CR / CRLF codes to  <br> html tags in order to save line break formatting.

applyHtmlFormatting

public static java.lang.String applyHtmlFormatting(java.lang.String text)
Applys some html formatting to the specified text. Actually, it does the following:

  • All CR/CRLF characters are replaced by  <br> tags to keep line-breaking formatting of original text

    Parameters:
    text - text to be formatted
    Returns:
    formatted text

  • getURL

    public java.net.URL getURL()
    Fixes the getURL() method in ITMill Toolkit Window class to avoid having slash "/" as the final url character. Having such character changes current web directory context so may cause problems in resources lookup.

    Overrides:
    getURL in class com.vaadin.ui.Window
    Returns:
    Window URL, with guarantee, that it will not end with the slash character.

    getActions

    public com.vaadin.event.Action[] getActions(java.lang.Object o,
                                                java.lang.Object o1)
    Specified by:
    getActions in interface com.vaadin.event.Action.Handler

    handleAction

    public void handleAction(com.vaadin.event.Action action,
                             java.lang.Object o,
                             java.lang.Object o1)
    Specified by:
    handleAction in interface com.vaadin.event.Action.Handler

    windowClose

    public void windowClose(com.vaadin.ui.Window.CloseEvent closeEvent)
    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
    Parameters:
    closeEvent - close event that came from toolkit

    enterKeyPressed

    public void enterKeyPressed()
    Called when user presses an ENTER key


    escapeKeyPressed

    public void escapeKeyPressed()
    Called when user presses an ESC key