|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itmill.toolkit.ui.AbstractComponent
com.itmill.toolkit.ui.AbstractComponentContainer
com.itmill.toolkit.ui.Panel
com.itmill.toolkit.ui.Window
public class Window
Application window component.
Nested Class Summary | |
---|---|
class |
Window.CloseEvent
|
static interface |
Window.CloseListener
|
static class |
Window.Notification
A notification message, used to display temporary messages to the user - for example "Document saved", or "Save failed". |
Nested classes/interfaces inherited from class com.itmill.toolkit.ui.AbstractComponent |
---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.URIHandler |
---|
URIHandler.ErrorEvent |
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.ParameterHandler |
---|
ParameterHandler.ErrorEvent |
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.ComponentContainer |
---|
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener |
Nested classes/interfaces inherited from interface com.itmill.toolkit.ui.Component |
---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
Nested classes/interfaces inherited from interface com.itmill.toolkit.terminal.Paintable |
---|
Paintable.RepaintRequestEvent, Paintable.RepaintRequestListener |
Field Summary | |
---|---|
static int |
BORDER_DEFAULT
Window with default borders. |
static int |
BORDER_MINIMAL
Window with only minimal border. |
static int |
BORDER_NONE
Window with no border. |
Fields inherited from class com.itmill.toolkit.ui.Panel |
---|
STYLE_LIGHT |
Fields inherited from interface com.itmill.toolkit.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 | |
---|---|
Window()
Creates a new empty unnamed window with default layout. |
|
Window(String caption)
Creates a new empty window with default layout. |
|
Window(String caption,
Layout layout)
Creates a new window. |
Method Summary | |
---|---|
void |
addListener(Window.CloseListener listener)
Adds the listener. |
void |
addParameterHandler(ParameterHandler handler)
Adds the new parameter handler to this window. |
void |
addURIHandler(URIHandler handler)
Adds the new URI handler to this window. |
void |
addWindow(Window window)
Adds a window inside another window. |
void |
center()
Request to center this window on the screen. |
void |
changeVariables(Object source,
Map variables)
Called when one or more variables handled by the implementing class are changed. |
protected void |
close()
Method that handles window closing (from UI). |
protected void |
fireClose()
|
Application |
getApplication()
Gets the application instance of the component. |
int |
getBorder()
Returns the border. |
Set |
getChildWindows()
Get the set of all child windows. |
String |
getName()
Gets the unique name of the window that indentifies it on the terminal. |
Component |
getParent()
Getter for property parent. |
int |
getPositionX()
Gets the distance of Window left border in pixels from left border of the containing (main window). |
int |
getPositionY()
Gets the distance of Window top border in pixels from top border of the containing (main window). |
String |
getTag()
Gets the component UIDL tag. |
Terminal |
getTerminal()
Gets the terminal type. |
String |
getTheme()
Gets the theme for this window. |
URL |
getURL()
Returns the full url of the window, this returns window specific url even for the main window. |
Window |
getWindow()
Gets the window of the component. |
void |
handleParameters(Map parameters)
Handles the given parameters. |
DownloadStream |
handleURI(URL context,
String relativeUri)
Handles uri recursively. |
boolean |
isModal()
|
boolean |
isResizable()
|
void |
open(Resource resource)
Opens the given resource in this window. |
void |
open(Resource resource,
String windowName)
Opens the given resource in named terminal window. |
void |
open(Resource resource,
String windowName,
int width,
int height,
int border)
Opens the given resource in named terminal window with given size and border properties. |
void |
paintContent(PaintTarget target)
Paints the content of this component. |
void |
removeListener(Window.CloseListener listener)
Removes the listener. |
void |
removeParameterHandler(ParameterHandler handler)
Removes the given URI handler from this window. |
void |
removeURIHandler(URIHandler handler)
Removes the given URI handler from this window. |
void |
removeWindow(Window window)
Remove the given subwindow from this window. |
void |
setApplication(Application application)
Sets the application this window is connected to. |
void |
setBorder(int border)
Sets the border. |
void |
setLayout(Layout newLayout)
Sets the layout of the panel. |
void |
setModal(boolean modality)
Sets sub-window modal, so that widgets behind it cannot be accessed. |
void |
setName(String name)
Sets the name. |
void |
setParent(Component parent)
Setter for property parent. |
void |
setPositionX(int positionX)
Sets the distance of Window left border in pixels from left border of the containing (main window). |
void |
setPositionY(int positionY)
Sets the distance of Window top border in pixels from top border of the containing (main window). |
void |
setResizable(boolean resizeability)
Sets sub-window resizable. |
void |
setTerminal(Terminal type)
Sets the terminal type. |
void |
setTheme(String theme)
Sets the theme for this window. |
void |
showNotification(String caption)
Shows a notification message on the middle of the window. |
void |
showNotification(String caption,
int type)
Shows a notification message the window. |
void |
showNotification(String caption,
String description)
Shows a notification consisting of a bigger caption and a smaller description on the middle of the window. |
void |
showNotification(String caption,
String description,
int type)
Shows a notification consisting of a bigger caption and a smaller description. |
void |
showNotification(Window.Notification notification)
Shows a notification message. |
Methods inherited from class com.itmill.toolkit.ui.Panel |
---|
addActionHandler, addComponent, attach, componentAttachedToContainer, componentDetachedFromContainer, detach, getComponentIterator, getLayout, getScrollLeft, getScrollOffsetX, getScrollOffsetY, getScrollTop, isScrollable, removeActionHandler, removeAllComponents, removeComponent, replaceComponent, requestRepaintAll, setScrollable, setScrollLeft, setScrollOffsetX, setScrollOffsetY, setScrollTop |
Methods inherited from class com.itmill.toolkit.ui.AbstractComponentContainer |
---|
addListener, addListener, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeListener, removeListener, setEnabled, setHeight, setWidth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.itmill.toolkit.ui.Component |
---|
addListener, addStyleName, childRequestedRepaint, getCaption, getIcon, getLocale, getStyleName, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.itmill.toolkit.terminal.Paintable |
---|
addListener, getDebugId, paint, removeListener, requestRepaint, requestRepaintRequests, setDebugId |
Methods inherited from interface com.itmill.toolkit.terminal.VariableOwner |
---|
isImmediate |
Methods inherited from interface com.itmill.toolkit.terminal.Sizeable |
---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUnits, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUnits |
Field Detail |
---|
public static final int BORDER_NONE
public static final int BORDER_MINIMAL
public static final int BORDER_DEFAULT
Constructor Detail |
---|
public Window()
To show the window in application, it must be added to application with
Application.addWindow
method.
The windows are scrollable by default.
caption
- the Title of the window.public Window(String caption)
To show the window in application, it must be added to application with
Application.addWindow
method.
The windows are scrollable by default.
caption
- the Title of the window.public Window(String caption, Layout layout)
To show the window in application, it must be added to application with
Application.addWindow
method.
The windows are scrollable by default.
caption
- the Title of the window.layout
- the Layout of the window.Method Detail |
---|
public void setLayout(Layout newLayout)
Panel
setLayout
in class Panel
newLayout
- the New layout of the panel.public Terminal getTerminal()
public final Window getWindow()
getWindow
in interface Component
getWindow
in class AbstractComponent
public final Application getApplication()
getApplication
in interface Component
getApplication
in class AbstractComponent
public final Component getParent()
Parent is the visual parent of a component. Each component can belong to only one ComponentContainer at time.
For windows attached directly to the application, parent is
null
. For windows inside other windows, parent is the window
containing this window.
getParent
in interface Component
getParent
in class AbstractComponent
public void setParent(Component parent)
Parent is the visual parent of a component. This is mostly called by containers add method and should not be called directly
setParent
in interface Component
setParent
in class AbstractComponent
parent
- the New value of property parent.public String getTag()
getTag
in class Panel
public void addURIHandler(URIHandler handler)
handler
- the URI handler to add.public void removeURIHandler(URIHandler handler)
handler
- the URI handler to remove.public DownloadStream handleURI(URL context, String relativeUri)
URIHandler
s added to it.
Note, that instead of overriding this method developer should consider
using addURIHandler(URIHandler)
to add uri handler to
Window.
handleURI
in interface URIHandler
context
- relativeUri
-
public void addParameterHandler(ParameterHandler handler)
handler
- the parameter handler to add.public void removeParameterHandler(ParameterHandler handler)
handler
- the parameter handler to remove.public void handleParameters(Map parameters)
ParameterHandler
Handles the given parameters. The parameters are given as inmodifieable
name to value map. All parameters names are of type:
String
. All the parameter values are arrays of strings.
handleParameters
in interface ParameterHandler
parameters
- the Inmodifiable name to value[] mapping.public String getTheme()
Subwindows do not support themes and thus return theme used by the parent
public void setTheme(String theme)
theme
- the New theme for this window. Null implies the default theme.public void paintContent(PaintTarget target) throws PaintException
paintContent
in class Panel
event
- the Paint Event.
PaintException
- if the paint operation failed.public void open(Resource resource)
resource
- public void open(Resource resource, String windowName)
null
window name results the resource to be opened in this
window.
resource
- the resource.windowName
- the name of the window.public void open(Resource resource, String windowName, int width, int height, int border)
null
window name results the
resource to be opened in this window.
resource
- windowName
- width
- height
- border
- public URL getURL()
public String getName()
Name identifies the URL used to access application-level windows, but is
not used for windows inside other windows. all application-level windows
can be accessed by their names in url
http://host:port/foo/bar/
where
http://host:port/foo/
is the application url as returned by
getURL() and bar
is the name of the window. Also note that
not all windows should be added to application - one can also add windows
inside other windows - these windows show as smaller windows inside those
windows.
public int getBorder()
public void setBorder(int border)
border
- the border to set.public void setApplication(Application application)
This method should not be invoked directly. Instead the
Application.addWindow(Window)
method should be
used to add the window to an application and
Application.removeWindow(Window)
method for
removing the window from the applicion. These methods call this method
implicitly.
The method invokes Component.attach()
and
Component.detach()
methods when necessary.
application
- the application to set.public void setName(String name)
The name of the window must be unique inside the application.
If the name is null, the the window is given name automatically when it is added to an application.
name
- the name to set.public void setTerminal(Terminal type)
type
- the terminal type to set.public void changeVariables(Object source, Map variables)
changeVariables
in interface VariableOwner
changeVariables
in class Panel
source
- the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables
- the Mapping from variable names to new variable values.VariableOwner.changeVariables(java.lang.Object,
java.util.Map)
protected void close()
By default, sub-windows are removed from their respective parent windows and thus visually closed on browser-side. Browser-level windows also closed on the client-side, but they are not implicitly removed from the application.
If one wants change the default behavior, register a window close listenter and do something else. For example, you could re-open the browser-level window with mainWindow.open(), re-add the removed sub-window back to its parent or remove browser-level window automatically from the application.
public int getPositionX()
public void setPositionX(int positionX)
positionX
- the Distance of Window left border in pixels from left border
of the containing (main window). or -1 if unspecified.public int getPositionY()
public void setPositionY(int positionY)
positionY
- the Distance of Window top border in pixels from top border of
the containing (main window). or -1 if unspecifiedpublic void addListener(Window.CloseListener listener)
listener
- the listener to add.public void removeListener(Window.CloseListener listener)
listener
- the listener to remove.protected void fireClose()
public void addWindow(Window window) throws IllegalArgumentException, NullPointerException
Adding windows inside another window creates "subwindows". These windows should not be added to application directly and are not accessible directly with any url. Addding windows implicitly sets their parents.
Only one level of subwindows are supported. Thus you can add windows
inside such windows whose parent is null
.
window
-
IllegalArgumentException
- if a window is added inside non-application level window.
NullPointerException
- if the given Window
is null
.public void removeWindow(Window window)
window
- Window to be removed.public Set getChildWindows()
public void setModal(boolean modality)
modality
- true if modality is to be turned onpublic boolean isModal()
public void setResizable(boolean resizeability)
resizable
- true if resizability is to be turned onpublic boolean isResizable()
public void center()
public void showNotification(String caption)
caption
- The messageshowNotification(com.itmill.toolkit.ui.Window.Notification)
,
Window.Notification
public void showNotification(String caption, int type)
Window.Notification
, for instance Notification.TYPE_WARNING_MESSAGE.
caption
- The messagetype
- The message typeshowNotification(com.itmill.toolkit.ui.Window.Notification)
,
Window.Notification
public void showNotification(String caption, String description)
caption
- The caption of the messagedescription
- The message descriptionshowNotification(com.itmill.toolkit.ui.Window.Notification)
,
Window.Notification
public void showNotification(String caption, String description, int type)
Window.Notification
,
for instance Notification.TYPE_WARNING_MESSAGE.
caption
- The caption of the messagedescription
- The message descriptiontype
- The message typeshowNotification(com.itmill.toolkit.ui.Window.Notification)
,
Window.Notification
public void showNotification(Window.Notification notification)
notification
- The notification message to showWindow.Notification
,
showNotification(String)
,
showNotification(String, int)
,
showNotification(String, String)
,
showNotification(String, String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |