creamtec.webcream.gui
Class WebCreamUIManager

java.lang.Object
  extended by creamtec.webcream.gui.WebCreamUIManager

public class WebCreamUIManager
extends java.lang.Object

Manages the UI elements such as windows and components. Maintains the information on the stack of windows (top to bottom) and provides various helper methods.


Field Summary
static int END_OPERATION_NEW_WINDOW
          Specifies taht the operation should be ended when a new window is displayed at the top (not an existing one moved to the top)
static int END_OPERATION_NEXT_WINDOW
          Specifies that the operation should be ended when there is a different top level window
static int END_OPERATION_NONE
          Specifies that the operation should not be ended by UI events
static int END_OPERATION_TITLED_WINDOW
          Specifies that the operation should be ended when a window with a certain title is shown
static boolean LFInstalled
           
 
Constructor Summary
WebCreamUIManager(ClientAgent agent)
          Instantiates the manager for the given client agent
 
Method Summary
 void afterEmulateRequest()
          Called after the emulation of the request is finished
static java.lang.String cleanupName(java.lang.String name)
          Removes/replaces characters in the name that can cause problems when used in HTML and JavaScript
static java.lang.String cleanupName(java.lang.String name, java.lang.String appendToName)
          Removes/replaces characters in the name that can cause problems when used in HTML and JavaScript
 void closeWindow(java.awt.Window window)
          Closes given window
static boolean dynamicEventsEnabled(HTMLPage page, java.awt.Component comp)
          Convenience method to determine if a component should be rendered with support for dynamic events Takes into account app properties but not component listeners
static java.lang.String getComponentKeyName(HTMLPage page, java.lang.Object object)
          Returns the key that is used to identify this component in the application properties file The key format is window.Window_Title.Component_Title
static java.lang.String getComponentKeyName(HTMLPage page, java.lang.Object object, java.lang.String appendKey)
          Returns the key that is used to identify this component in the application properties file The key format is window.Window_Title.Component_Title
static java.lang.String getComponentName(java.awt.Component comp)
          Returns component name that can be used to identify it in a properties file If component has been given a name, it is used.
 java.awt.Window getWindowInFocus()
          Returns the top level window for this agent
 java.lang.String getWindowInFocusTitle()
          Convenience method that returns the title of the top level window If there is no window or if the focused window is not Dialog or Frame returns null
 void hideWindow(java.awt.Window window)
          Called by Window peer to indicate that a window is being hidden Removes the window from top of the window stack and processes window-related operations
 void init()
          Initializes the manager and installs a trap to prevent look and feel changes (they slow down the performance and can lead to various exceptions)
 void installLFTrap()
          Installs look and feel trap
 void maximizeFrame(java.awt.Frame frame)
          Sets the window size to the maximim possible for the current browser window
 void resizeWindows()
          Updates sizes of maximized windows to match the client agent's current browser size
 void setEndOperationEvent(int eventCode)
          Sets code of the operation that needs to be executed when a window is closed See WebCream documentation on how to configure and use operations
 void setEndOperationWindowTitle(java.lang.String windowTitle)
          Sets the title of the window that should trigger an operation
static boolean shouldRenderEnabled(ClientAgent agent, java.awt.Component comp)
          Convenience method to determine if a component should be rendered as enabled or disabled Takes into account app properties and the component state
static boolean shouldRenderStandardFileOpenDialog(ClientAgent agent, java.awt.Container cont)
          Returns true if the given window should be rendered as a stanard file open dialog with the view of the client machine for file upload
 void showWindow(java.awt.Window window)
          Called by Window peer to indicate that a window is being shown.
 void shutdown()
          Disposes of all currently open windows
static java.lang.String titleToKey(java.lang.String title)
          Converts given string title to a form, acceptable as a property in the properties file (hash table)
 void windowToBack(java.awt.Window window)
          Moves the given window to the bottom of the window stack
 void windowToFront(java.awt.Window window)
          Moves the given window on top of the window stack
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LFInstalled

public static boolean LFInstalled

END_OPERATION_NONE

public static final int END_OPERATION_NONE
Specifies that the operation should not be ended by UI events

See Also:
Constant Field Values

END_OPERATION_NEXT_WINDOW

public static final int END_OPERATION_NEXT_WINDOW
Specifies that the operation should be ended when there is a different top level window

See Also:
Constant Field Values

END_OPERATION_NEW_WINDOW

public static final int END_OPERATION_NEW_WINDOW
Specifies taht the operation should be ended when a new window is displayed at the top (not an existing one moved to the top)

See Also:
Constant Field Values

END_OPERATION_TITLED_WINDOW

public static final int END_OPERATION_TITLED_WINDOW
Specifies that the operation should be ended when a window with a certain title is shown

See Also:
Constant Field Values
Constructor Detail

WebCreamUIManager

public WebCreamUIManager(ClientAgent agent)
                  throws java.lang.Exception
Instantiates the manager for the given client agent

Parameters:
agent - ClientAgent
Throws:
java.lang.Exception
Method Detail

init

public void init()
          throws java.lang.Exception
Initializes the manager and installs a trap to prevent look and feel changes (they slow down the performance and can lead to various exceptions)

Throws:
java.lang.Exception

getWindowInFocus

public java.awt.Window getWindowInFocus()
                                 throws java.lang.Exception
Returns the top level window for this agent

Returns:
Window
Throws:
java.lang.Exception

resizeWindows

public void resizeWindows()
                   throws java.lang.Exception
Updates sizes of maximized windows to match the client agent's current browser size

Throws:
java.lang.Exception

maximizeFrame

public void maximizeFrame(java.awt.Frame frame)
Sets the window size to the maximim possible for the current browser window

Parameters:
frame -

showWindow

public void showWindow(java.awt.Window window)
Called by Window peer to indicate that a window is being shown. Stores the window on top of the window stack and processes window-related operations.

Parameters:
window - Window

hideWindow

public void hideWindow(java.awt.Window window)
Called by Window peer to indicate that a window is being hidden Removes the window from top of the window stack and processes window-related operations

Parameters:
window - Window

windowToFront

public void windowToFront(java.awt.Window window)
Moves the given window on top of the window stack

Parameters:
window - Window

windowToBack

public void windowToBack(java.awt.Window window)
Moves the given window to the bottom of the window stack

Parameters:
window - Window

closeWindow

public void closeWindow(java.awt.Window window)
Closes given window


shutdown

public void shutdown()
Disposes of all currently open windows


setEndOperationEvent

public void setEndOperationEvent(int eventCode)
Sets code of the operation that needs to be executed when a window is closed See WebCream documentation on how to configure and use operations

Parameters:
eventCode - one of END_OPERATION_XXX constants

setEndOperationWindowTitle

public void setEndOperationWindowTitle(java.lang.String windowTitle)
Sets the title of the window that should trigger an operation

Parameters:
windowTitle - String

installLFTrap

public void installLFTrap()
                   throws java.lang.Exception
Installs look and feel trap

Throws:
java.lang.Exception

shouldRenderEnabled

public static boolean shouldRenderEnabled(ClientAgent agent,
                                          java.awt.Component comp)
Convenience method to determine if a component should be rendered as enabled or disabled Takes into account app properties and the component state

Returns:
true if the component should be rendered enabled

dynamicEventsEnabled

public static boolean dynamicEventsEnabled(HTMLPage page,
                                           java.awt.Component comp)
Convenience method to determine if a component should be rendered with support for dynamic events Takes into account app properties but not component listeners

Returns:
true if dynamic events should be enabled for this component

shouldRenderStandardFileOpenDialog

public static boolean shouldRenderStandardFileOpenDialog(ClientAgent agent,
                                                         java.awt.Container cont)
Returns true if the given window should be rendered as a stanard file open dialog with the view of the client machine for file upload

Returns:
true if the given window should be rendered as a stanard file open dialog with the view of the client machine for file upload

getComponentKeyName

public static java.lang.String getComponentKeyName(HTMLPage page,
                                                   java.lang.Object object)
Returns the key that is used to identify this component in the application properties file The key format is window.Window_Title.Component_Title

Returns:
component key name

getComponentKeyName

public static java.lang.String getComponentKeyName(HTMLPage page,
                                                   java.lang.Object object,
                                                   java.lang.String appendKey)
Returns the key that is used to identify this component in the application properties file The key format is window.Window_Title.Component_Title

Parameters:
appendKey - if not null, is appended to the end of the auto-generated key

getComponentName

public static java.lang.String getComponentName(java.awt.Component comp)
Returns component name that can be used to identify it in a properties file If component has been given a name, it is used. Otherwise the name is generated as a componet class name

Returns:
component name

cleanupName

public static java.lang.String cleanupName(java.lang.String name)
Removes/replaces characters in the name that can cause problems when used in HTML and JavaScript

Parameters:
name - String
Returns:
cleaned up name

cleanupName

public static java.lang.String cleanupName(java.lang.String name,
                                           java.lang.String appendToName)
Removes/replaces characters in the name that can cause problems when used in HTML and JavaScript

Parameters:
name - name
appendToName - this string is appended to the name before the cleanup takes place
Returns:
cleaned up name

titleToKey

public static java.lang.String titleToKey(java.lang.String title)
Converts given string title to a form, acceptable as a property in the properties file (hash table)

Returns:
key name

afterEmulateRequest

public void afterEmulateRequest()
                         throws java.lang.Exception
Called after the emulation of the request is finished

Throws:
java.lang.Exception

getWindowInFocusTitle

public java.lang.String getWindowInFocusTitle()
Convenience method that returns the title of the top level window If there is no window or if the focused window is not Dialog or Frame returns null

Returns:
String title or null


Copyright © 2000-2006 CreamTec LLC. All Rights Reserved.