com.leafdigital.ui.api
Interface Window

All Superinterfaces:
WidgetOwner

public interface Window
extends WidgetOwner

This interface represents the contents of a single Window within the system. 'Windows' may be operating-system level windows, subwindows, or even areas in tabs depending on the user's chosen interface style.


Method Summary
 void activate()
          Activates the window (brings it to front and sets keyboard focus).
 void attention()
          Call when something important has happened in this window and the user should be visually notified (if it isn't on top).
 void close()
          Closes the window.
 boolean getCanClearAttention()
           
 java.lang.String getExtraRemember()
           
 java.lang.String getTitle()
           
 boolean isActive()
           
 boolean isClosed()
           
 boolean isHidden()
           
 boolean isMinimized()
           
 void minimize()
          Minimises the window.
 void setCanClearAttention(boolean canClearAttention)
          Sets whether the window can clear attention if the user activates it or otherwise makes it visible.
 void setClosable(boolean closeable)
          Sets whether the user can close the window.
 void setContents(org.w3c.dom.Element e)
          Clears existing contents and sets the contents of the window based on an XML document.
 void setContents(Widget w)
          Clears existing contents and sets the contents of the window to a single widget.
 void setExtraRemember(java.lang.String text)
          Store additional text that will be remembered with the window position.
 void setIcon(java.awt.Image icon)
          Sets the window's icon; used in title bars and switchbar.
 void setInitialSize(int width, int height)
          Set the window's initial size.
 void setMinSize(int minWidth, int minHeight)
          Set the minimum size for this window.
 void setOnActive(java.lang.String callback)
          Sets the action method called when window becomes active (current).
 void setOnClosed(java.lang.String callback)
          Sets the action method called when window is closed.
 void setOnClosing(java.lang.String callback)
          Sets the action method called when window is about to be closed.
 void setRemember(java.lang.String category, java.lang.String id)
          Set details used to remember the window position.
 void setResizable(boolean resizable)
          Set whether the user can resize the window.
 void setTitle(java.lang.String title)
          Sets the window's title; used in title bars and switchbar.
 void show(boolean minimised)
          Call when the window is ready to show.
 
Methods inherited from interface com.leafdigital.ui.api.WidgetOwner
getCallbackHandler, getGroupSelected, getWidget, isCreated, setWidgetID
 

Method Detail

setTitle

void setTitle(java.lang.String title)
Sets the window's title; used in title bars and switchbar.

Parameters:
title - New title text

getTitle

java.lang.String getTitle()
Returns:
Window's current title

setIcon

void setIcon(java.awt.Image icon)
Sets the window's icon; used in title bars and switchbar.

Parameters:
icon - Image to use for icon (can be any size, but should be square; will be resized to necessary size; must be fully loaded, for example a BufferedImage or obtained via lc.util.loadImage)

attention

void attention()
Call when something important has happened in this window and the user should be visually notified (if it isn't on top).


setCanClearAttention

void setCanClearAttention(boolean canClearAttention)
Sets whether the window can clear attention if the user activates it or otherwise makes it visible. Set false to indicate that a window might not actually be displaying the information that attention() was supposed to highlight.

Parameters:
canClearAttention - True if attention will be cleared, false if it won't

getCanClearAttention

boolean getCanClearAttention()
Returns:
The 'can clear attention' flag

setInitialSize

void setInitialSize(int width,
                    int height)
Set the window's initial size. This size is used when the window is shown, unless the system has remembered a size for the window in preferences.

Calling this after the window has been shown has no effect. If you choose a size lower than the minimum, the minimum will be used.

Parameters:
width - Initial width
height - Initial height

setResizable

void setResizable(boolean resizable)
Set whether the user can resize the window. The default is true.

Parameters:
resizable - True if user can resize window.

setClosable

void setClosable(boolean closeable)
Sets whether the user can close the window. The default is true.

Parameters:
closeable - True if user can close window.

setMinSize

void setMinSize(int minWidth,
                int minHeight)
Set the minimum size for this window. The system imposes its own minimum, so if you choose a very low minimum size it will be ignored.

Parameters:
minWidth -
minHeight -

setRemember

void setRemember(java.lang.String category,
                 java.lang.String id)
Set details used to remember the window position. If you don't call this method, the window position will not be remembered from one run to the next.

Parameters:
category - Category of window (must follow the rules for preferences tokens, i.e. must start with a letter, all characters must be letters, digits, - or _)
id - ID of window (should be unique within category; may be null if there is never more than one window of that category; can include any characters)

setExtraRemember

void setExtraRemember(java.lang.String text)
Store additional text that will be remembered with the window position.

Parameters:
text - Extra text

getExtraRemember

java.lang.String getExtraRemember()
Returns:
Extra text that was remembered with the window position, or null if none.

show

void show(boolean minimised)
Call when the window is ready to show. Nothing will be displayed until you call this method.

Parameters:
minimised - If true, initially shows in minimised state

setContents

void setContents(Widget w)
Clears existing contents and sets the contents of the window to a single widget.

Parameters:
w - Desired widget

setContents

void setContents(org.w3c.dom.Element e)
Clears existing contents and sets the contents of the window based on an XML document.

Parameters:
e - XML element; must follow the appropriate format
Throws:
BugException - If there are format problems with the XML

close

void close()
Closes the window. This is a permanent operation; once closed, the window may not be shown again.


isClosed

boolean isClosed()
Returns:
True if window has been closed

minimize

void minimize()
Minimises the window. (Does nothing if it's already minimised.)


activate

void activate()
Activates the window (brings it to front and sets keyboard focus).


isActive

boolean isActive()
Returns:
True if window is currently active

setOnClosed

@UICallback
void setOnClosed(java.lang.String callback)
Sets the action method called when window is closed.

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

setOnClosing

@UICallback
void setOnClosing(java.lang.String callback)
Sets the action method called when window is about to be closed. If you set this, you must manually call close() after receiving this callback; the window won't close automatically.

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

setOnActive

@UICallback
void setOnActive(java.lang.String callback)
Sets the action method called when window becomes active (current).

Parameters:
callback - Name of method
Throws:
BugException - If method doesn't exist etc.

isHidden

boolean isHidden()
Returns:
True if window is currently hidden (e.g. a tab that is not current).

isMinimized

boolean isMinimized()
Returns:
True if window is currently minimized.


Copyright © 2011 Samuel Marshall. All rights reserved.