org.vostok.vaadin.addon.dialog
Class WindowManagement

java.lang.Object
  extended by org.vostok.vaadin.addon.dialog.WindowManagement

public class WindowManagement
extends java.lang.Object

WindowManagement is an helper class.
It can manager visible state of a window (including ActionWindow), i.e. is this dialog box already opened ? ; to do so it requires an unique name for each dialog box. It can help preventing opening the same dialog box twice.
It can also be used to dynamically instance window from class (com.vaadin.ui.Component). If the window already exist, it will use it instead of creating a new instance.
Note a com.vaadin.ui.Component will be wrapped into an org.vostok.vaadin.addon.dialog.ActionWindow when a com.vaadin.ui.Window will be used directly instead. You can also use paramaters as an java.lang.Object Note WindowManagement will override window's Id .
Since version 1.5, WindowManagement has a new method public static void closeAll(String pattern) This is another helper method you can use to close several window at once; specially useful to "clean up" before view change, as this application is doing. Check the java tab.
See sample at http://vaadin.vostoksystem.eu

Version:
1.5
Author:
levreau.jerome@vostoksystem.eu

Nested Class Summary
static interface WindowManagement.Callback
          Passing argument with constructor is not always practical.
 
Constructor Summary
WindowManagement()
           
 
Method Summary
static void close(java.lang.String name)
          close window with name name and remove resource from current ui pool.
static void closeAll(java.lang.String pattern)
          Close all window with name matching pattern, or all if pattern is null.
static com.vaadin.ui.Window locate(java.lang.String name)
          try to locate a window from the current ui pool.
static com.vaadin.ui.Window show(java.lang.String name)
          Tries to show window with name name.
static com.vaadin.ui.Window show(java.lang.String name, java.lang.Class type, java.lang.Object argument)
          Tries to show window with name name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowManagement

public WindowManagement()
Method Detail

show

public static com.vaadin.ui.Window show(java.lang.String name,
                                        java.lang.Class type,
                                        java.lang.Object argument)
Tries to show window with name name. If does not exist, create a new with name name of type type with initial parameters argument.
type must implement com.vaadin.ui.Component
Method will first try a constructor with a signature as contructor(Object argument). If faild, try againt with en emply constructor. Instance will get id name if type does not extend com.vaadin.ui.Window, it will be wrap into an ActionWindow.
if type implement WindowManagement.Callback, onLoad(argument) will then be fired

Parameters:
name - unique name for the window. Mandatory
type - class implementation, must implement com.vaadin.ui.Component at least, or extend com.vaadin.ui.Window
argument - argument for constructor or onLoad method, can be null.
Returns:
new Window, new ActionWindow or current instance if already exist
See Also:
ActionWindow, WindowManagement.Callback

show

public static com.vaadin.ui.Window show(java.lang.String name)
Tries to show window with name name.

Parameters:
name - name for window
Returns:
Window or null

close

public static void close(java.lang.String name)
close window with name name and remove resource from current ui pool.
If doesn't exist, do nothing.

Parameters:
name - name for window

closeAll

public static void closeAll(java.lang.String pattern)
Close all window with name matching pattern, or all if pattern is null.
tip : call it from your UI.beforeViewChange to automatically close all windows

Parameters:
pattern - regexp for window's name to close or null for all
Since:
1.5

locate

public static com.vaadin.ui.Window locate(java.lang.String name)
try to locate a window from the current ui pool. This method does not sho window on screen.

Parameters:
name - name for window
Returns:
Window or null if not found