org.millstone.base.ui
Class Window

java.lang.Object
  |
  +--org.millstone.base.ui.AbstractComponent
        |
        +--org.millstone.base.ui.AbstractComponentContainer
              |
              +--org.millstone.base.ui.Panel
                    |
                    +--org.millstone.base.ui.Window
All Implemented Interfaces:
Component, ComponentContainer, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachListener, java.util.EventListener, MethodEventSource, Paintable, ParameterHandler, Scrollable, Sizeable, URIHandler, VariableOwner
Direct Known Subclasses:
DebugWindow, FrameWindow

public class Window
extends Panel
implements URIHandler, ParameterHandler

Application window component.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
 
Nested classes inherited from class org.millstone.base.ui.ComponentContainer
ComponentContainer.ComponentAttachEvent, ComponentContainer.ComponentAttachListener, ComponentContainer.ComponentDetachEvent, ComponentContainer.ComponentDetachListener
 
Nested classes inherited from class org.millstone.base.ui.Component
Component.Event, Component.Listener
 
Nested classes inherited from class org.millstone.base.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 interface org.millstone.base.terminal.Sizeable
UNIT_SYMBOLS, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
Window()
          Create new empty unnamed window with default layout.
Window(java.lang.String caption)
          Create new empty window with default layout.
Window(java.lang.String caption, Layout layout)
          Create new window.
 
Method Summary
 void addParameterHandler(ParameterHandler handler)
          Add new parameter handler to this window.
 void addURIHandler(URIHandler handler)
          Add new URI handler to this window
 Application getApplication()
          Get application instance of the component.
 int getBorder()
          Returns the border.
 java.lang.String getName()
          Get the unique name of the window that indentifies it on the terminal.
 Component getParent()
          Getter for property parent.
 java.lang.String getTag()
          Get component UIDL tag.
 Terminal getTerminal()
          Get terminal type.
 java.lang.String getTheme()
          Get theme for this window.
 java.net.URL getURL()
          Returns the full url of the window, this returns window specific url even for the main window.
 Window getWindow()
          Get window of the component.
 void handleParameters(java.util.Map parameters)
          Handle parameters.
 DownloadStream handleURI(java.net.URL context, java.lang.String relativeUri)
          Handle uri recursively.
 void open(Resource resource)
          Open the given resource in this window.
 void open(Resource resource, java.lang.String windowName)
          Open the given resource in named terminal window.
 void open(Resource resource, java.lang.String windowName, int width, int height, int border)
          Open the given resource in named terminal window with given size and border properties.
 void paintContent(PaintTarget target)
          Paint the content of this component.
 void removeParameterHandler(ParameterHandler handler)
          Remove given URI handler from this window.
 void removeURIHandler(URIHandler handler)
          Remove given URI handler from this window
 void setApplication(Application application)
          Sets the application this window is connected to.
 void setBorder(int border)
          Sets the border.
 void setHeightUnits(int units)
          Window only supports pixels as unit.
 void setName(java.lang.String name)
          Sets the name.
 void setParent(Component parent)
          Setter for property parent.
 void setTerminal(Terminal type)
          Set terminal type.
 void setTheme(java.lang.String theme)
          Set theme for this window.
 void setWidthUnits(int units)
          Window only supports pixels as unit.
 
Methods inherited from class org.millstone.base.ui.Panel
addComponent, changeVariables, componentAttachedToContainer, componentDetachedFromContainer, getComponentIterator, getHeight, getHeightUnits, getLayout, getScrollOffsetX, getScrollOffsetY, getWidth, getWidthUnits, isScrollable, removeComponent, replaceComponent, setHeight, setLayout, setScrollable, setScrollOffsetX, setScrollOffsetY, setWidth
 
Methods inherited from class org.millstone.base.ui.AbstractComponentContainer
addListener, addListener, attach, detach, fireComponentAttachEvent, fireComponentDetachEvent, moveComponentsFrom, removeAllComponents, removeListener, removeListener
 
Methods inherited from class org.millstone.base.ui.AbstractComponent
addListener, addListener, addListener, addListener, childRequestedRepaint, dependsOn, fireComponentEvent, fireEvent, getCaption, getComponentError, getDescription, getDirectDependencies, getErrorMessage, getIcon, getLocale, getStyle, isEnabled, isImmediate, isReadOnly, isVisible, paint, removeDirectDependency, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setDescription, setEnabled, setIcon, setImmediate, setLocale, setReadOnly, setStyle, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millstone.base.ui.Component
addListener, childRequestedRepaint, getCaption, getIcon, getLocale, getStyle, isEnabled, isImmediate, isReadOnly, isVisible, removeListener, setEnabled, setReadOnly, setStyle, setVisible
 
Methods inherited from interface org.millstone.base.terminal.Paintable
addListener, paint, removeListener, requestRepaint, requestRepaintRequests
 
Methods inherited from interface org.millstone.base.terminal.VariableOwner
dependsOn, getDirectDependencies, removeDirectDependency
 

Field Detail

BORDER_NONE

public static final int BORDER_NONE
Window with no border

See Also:
Constant Field Values

BORDER_MINIMAL

public static final int BORDER_MINIMAL
Window with only minimal border

See Also:
Constant Field Values

BORDER_DEFAULT

public static final int BORDER_DEFAULT
Window with default borders

See Also:
Constant Field Values
Constructor Detail

Window

public Window()
Create new empty unnamed window with default layout.

To show the window in application, it must be added to application with Application.addWindow() method.

The windows are scrollable by default.


Window

public Window(java.lang.String caption)
Create new empty window with default layout.

To show the window in application, it must be added to application with Application.addWindow() method.

The windows are scrollable by default.

Parameters:
caption - Title of the window

Window

public Window(java.lang.String caption,
              Layout layout)
Create new window.

To show the window in application, it must be added to application with Application.addWindow() method.

The windows are scrollable by default.

Parameters:
caption - Title of the window
layout - Layout of the window
Method Detail

getTerminal

public Terminal getTerminal()
Get terminal type.

Returns:
Value of property terminal.

getWindow

public final Window getWindow()
Get window of the component. Returns the window where this component belongs to. If the component does not yet belong to a window the returns null.

Specified by:
getWindow in interface Component
Overrides:
getWindow in class AbstractComponent
Returns:
parent window of the component.

getApplication

public final Application getApplication()
Get application instance of the component. Returns the application where this component belongs to. If the component does not yet belong to a application the returns null.

Specified by:
getApplication in interface Component
Overrides:
getApplication in class AbstractComponent
Returns:
parent application of the component.

getParent

public final Component getParent()
Getter for property parent. Parent is the visual parent of a component. Each component can belong to only one ComponentContainer at time.

Specified by:
getParent in interface Component
Overrides:
getParent in class AbstractComponent
Returns:
Value of property parent.

setParent

public void setParent(Component parent)
Setter for property parent. Parent is the visual parent of a component. This is mostly called by containers add method. Setting parent is not allowed for the window, and thus this call should newer be called.

Specified by:
setParent in interface Component
Overrides:
setParent in class AbstractComponent
Parameters:
parent - New value of property parent.

getTag

public java.lang.String getTag()
Get component UIDL tag.

Overrides:
getTag in class Panel
Returns:
Component UIDL tag as string.

addURIHandler

public void addURIHandler(URIHandler handler)
Add new URI handler to this window


removeURIHandler

public void removeURIHandler(URIHandler handler)
Remove given URI handler from this window


handleURI

public DownloadStream handleURI(java.net.URL context,
                                java.lang.String relativeUri)
Handle uri recursively.

Specified by:
handleURI in interface URIHandler

addParameterHandler

public void addParameterHandler(ParameterHandler handler)
Add new parameter handler to this window.


removeParameterHandler

public void removeParameterHandler(ParameterHandler handler)
Remove given URI handler from this window.


handleParameters

public void handleParameters(java.util.Map parameters)
Description copied from interface: ParameterHandler
Handle parameters.

Handle 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.

Specified by:
handleParameters in interface ParameterHandler
Parameters:
parameters - Inmodifiable name to value[] mapping.

getTheme

public java.lang.String getTheme()
Get theme for this window.

Returns:
Name of the theme used in window. If the theme for this individual window is not explicitly set, the application theme is used instead. If application is not assigned the terminal.getDefaultTheme is used. If terminal is not set, null is returned

setTheme

public void setTheme(java.lang.String theme)
Set theme for this window.

Parameters:
theme - New theme for this window. Null implies the default theme.

paintContent

public void paintContent(PaintTarget target)
                  throws PaintException
Paint the content of this component.

Overrides:
paintContent in class Panel
Throws:
PaintException - The paint operation failed.

open

public void open(Resource resource)
Open the given resource in this window.


open

public void open(Resource resource,
                 java.lang.String windowName)
Open the given resource in named terminal window. Empty or null window name results the resource to be opened in this window.


open

public void open(Resource resource,
                 java.lang.String windowName,
                 int width,
                 int height,
                 int border)
Open the given resource in named terminal window with given size and border properties. Empty or null window name results the resource to be opened in this window.


getURL

public java.net.URL getURL()
Returns the full url of the window, this returns window specific url even for the main window.

Returns:
String

getName

public java.lang.String getName()
Get the unique name of the window that indentifies it on the terminal.

Returns:
String

getBorder

public int getBorder()
Returns the border.

Returns:
int

setBorder

public void setBorder(int border)
Sets the border.

Parameters:
border - The border to set

setApplication

public void setApplication(Application application)
Sets the application this window is connected to.

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.

Parameters:
application - The application to set

setName

public void setName(java.lang.String name)
Sets the name.

The name of the window must be unique inside the application. Also the name may only contain the following characters: a-z, A-Z and 0-9.

If the name is null, the the window is given name automatically when it is added to an application.

Parameters:
name - The name to set

setTerminal

public void setTerminal(Terminal type)
Set terminal type. The terminal type is set by the the terminal adapter and may change from time to time.

Parameters:
type - terminal type to set

setHeightUnits

public void setHeightUnits(int units)
Window only supports pixels as unit.

Specified by:
setHeightUnits in interface Sizeable
Overrides:
setHeightUnits in class Panel
See Also:
Sizeable.getHeightUnits()

setWidthUnits

public void setWidthUnits(int units)
Window only supports pixels as unit.

Specified by:
setWidthUnits in interface Sizeable
Overrides:
setWidthUnits in class Panel
See Also:
Sizeable.getWidthUnits()


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.