com.itmill.toolkit.terminal.gwt.client
Class ApplicationConnection

java.lang.Object
  extended by com.itmill.toolkit.terminal.gwt.client.ApplicationConnection

public class ApplicationConnection
extends Object

Entry point classes define onModuleLoad().


Field Summary
static String PARAM_UNLOADBURST
           
static String UIDL_SECURITY_HEADER
           
static String VAR_BURST_SEPARATOR
           
static String VAR_FIELD_SEPARATOR
           
static String VAR_RECORD_SEPARATOR
           
 
Constructor Summary
ApplicationConnection(WidgetSet widgetSet, ApplicationConfiguration cnf)
           
 
Method Summary
 void addPngFix(com.google.gwt.user.client.Element el)
          Adds PNG-fix conditionally (only for IE6) to the specified IMG -element.
 void analyzeLayouts()
           
 void captionSizeUpdated(Paintable component)
           
 void forceLayout()
          This will cause re-layouting of all components.
 String getAppUri()
           
static Console getConsole()
           
 IContextMenu getContextMenu()
          Singleton method to get instance of app's context menu.
 Paintable getPaintable(String id)
          Returns Paintable element by its id
 Paintable getPaintable(UIDL uidl)
          Get either existing or new Paintable for given UIDL.
 RenderInformation.FloatSize getRelativeSize(com.google.gwt.user.client.ui.Widget widget)
           
 String getResource(String name)
           
 String getThemeUri()
           
 TooltipInfo getTitleInfo(Paintable titleOwner)
          Data showed in tooltips are stored centrilized as it may be needed in varios place: caption, layouts, and in owner components themselves.
 boolean handleComponentRelativeSize(com.google.gwt.user.client.ui.Widget child)
          Converts relative sizes into pixel sizes.
 void handleTooltipEvent(com.google.gwt.user.client.Event event, Paintable owner)
          Component may want to delegate Tooltip handling to client.
 boolean hasActiveRequest()
           
static boolean isDebugMode()
          Checks if client side is in debug mode.
static boolean isTestingMode()
          Method to check if application is in testing mode.
 void registerPaintable(String id, Paintable paintable)
           
 void requestLayoutPhase()
          Components can call this function to run all layout functions.
 void runDescendentsLayout(com.google.gwt.user.client.ui.HasWidgets container)
           
 void sendPendingVariableChanges()
          This method sends currently queued variable changes to server.
 void sendPendingVariableChangesSync()
          This method assures that all pending variable changes are sent to server.
 void setWindowName(String newName)
          Reset the name of the current browser-window.
 String translateToolkitUri(String toolkitUri)
          Translates custom protocols in UIRL URI's to be recognizable by browser.
 void unregisterChildPaintables(com.google.gwt.user.client.ui.HasWidgets container)
           
 void unregisterPaintable(Paintable p)
           
 boolean updateComponent(com.google.gwt.user.client.ui.Widget component, UIDL uidl, boolean manageCaption)
          Update generic component features.
 void updateVariable(String paintableId, String variableName, boolean newValue, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, double newValue, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, float newValue, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, int newValue, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, long newValue, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, Object[] values, boolean immediate)
           
 void updateVariable(String paintableId, String variableName, String newValue, boolean immediate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VAR_RECORD_SEPARATOR

public static final String VAR_RECORD_SEPARATOR
See Also:
Constant Field Values

VAR_FIELD_SEPARATOR

public static final String VAR_FIELD_SEPARATOR
See Also:
Constant Field Values

VAR_BURST_SEPARATOR

public static final String VAR_BURST_SEPARATOR
See Also:
Constant Field Values

UIDL_SECURITY_HEADER

public static final String UIDL_SECURITY_HEADER
See Also:
Constant Field Values

PARAM_UNLOADBURST

public static final String PARAM_UNLOADBURST
See Also:
Constant Field Values
Constructor Detail

ApplicationConnection

public ApplicationConnection(WidgetSet widgetSet,
                             ApplicationConfiguration cnf)
Method Detail

isTestingMode

public static boolean isTestingMode()
Method to check if application is in testing mode. Can be used after application init.

Returns:
true if in testing mode

getConsole

public static Console getConsole()

isDebugMode

public static boolean isDebugMode()
Checks if client side is in debug mode. Practically this is invoked by adding ?debug parameter to URI.

Returns:
true if client side is currently been debugged

getAppUri

public String getAppUri()

hasActiveRequest

public boolean hasActiveRequest()

sendPendingVariableChangesSync

public void sendPendingVariableChangesSync()
This method assures that all pending variable changes are sent to server. Method uses synchronized xmlhttprequest and does not return before the changes are sent. No UIDL updates are processed and thut UI is left in inconsistent state. This method should be called only when closing windows - normally sendPendingVariableChanges() should be used.


registerPaintable

public void registerPaintable(String id,
                              Paintable paintable)

unregisterPaintable

public void unregisterPaintable(Paintable p)

unregisterChildPaintables

public void unregisterChildPaintables(com.google.gwt.user.client.ui.HasWidgets container)

getPaintable

public Paintable getPaintable(String id)
Returns Paintable element by its id

Parameters:
id - Paintable ID

sendPendingVariableChanges

public void sendPendingVariableChanges()
This method sends currently queued variable changes to server. It is called when immediate variable update must happen. To ensure correct order for variable changes (due servers multithreading or network), we always wait for active request to be handler before sending a new one. If there is an active request, we will put varible "burst" to queue that will be purged after current request is handled.


updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           String newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           int newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           long newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           float newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           double newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           boolean newValue,
                           boolean immediate)

updateVariable

public void updateVariable(String paintableId,
                           String variableName,
                           Object[] values,
                           boolean immediate)

updateComponent

public boolean updateComponent(com.google.gwt.user.client.ui.Widget component,
                               UIDL uidl,
                               boolean manageCaption)
Update generic component features.

Selecting correct implementation

The implementation of a component depends on many properties, including styles, component features, etc. Sometimes the user changes those properties after the component has been created. Calling this method in the beginning of your updateFromUIDL -method automatically replaces your component with more appropriate if the requested implementation changes.

Caption, icon, error messages and description

Component can delegate management of caption, icon, error messages and description to parent layout. This is optional an should be decided by component author

Component visibility and disabling

This method will manage component visibility automatically and if component is an instanceof FocusWidget, also handle component disabling when needed.

Parameters:
component - Widget to be updated, expected to implement an instance of Paintable
uidl - UIDL to be painted
manageCaption - True if you want to delegate caption, icon, description and error message management to parent.
Returns:
Returns true iff no further painting is needed by caller

runDescendentsLayout

public void runDescendentsLayout(com.google.gwt.user.client.ui.HasWidgets container)

forceLayout

public void forceLayout()
This will cause re-layouting of all components. Mainly used for development. Published to JavaScript.


handleComponentRelativeSize

public boolean handleComponentRelativeSize(com.google.gwt.user.client.ui.Widget child)
Converts relative sizes into pixel sizes.

Parameters:
child -
Returns:
true if the child has a relative size

getRelativeSize

public RenderInformation.FloatSize getRelativeSize(com.google.gwt.user.client.ui.Widget widget)

getPaintable

public Paintable getPaintable(UIDL uidl)
Get either existing or new Paintable for given UIDL. If corresponding Paintable has been previously painted, return it. Otherwise create and register a new Paintable from UIDL. Caller must update the returned Paintable from UIDL after it has been connected to parent.

Parameters:
uidl - UIDL to create Paintable from.
Returns:
Either existing or new Paintable corresponding to UIDL.

getResource

public String getResource(String name)

getContextMenu

public IContextMenu getContextMenu()
Singleton method to get instance of app's context menu.

Returns:
IContextMenu object

translateToolkitUri

public String translateToolkitUri(String toolkitUri)
Translates custom protocols in UIRL URI's to be recognizable by browser. All uri's from UIDL should be routed via this method before giving them to browser due URI's in UIDL may contain custom protocols like theme://.

Parameters:
toolkitUri - toolkit URI from uidl
Returns:
translated URI ready for browser

getThemeUri

public String getThemeUri()

getTitleInfo

public TooltipInfo getTitleInfo(Paintable titleOwner)
Data showed in tooltips are stored centrilized as it may be needed in varios place: caption, layouts, and in owner components themselves. Updating TooltipInfo is done in updateComponent method.


handleTooltipEvent

public void handleTooltipEvent(com.google.gwt.user.client.Event event,
                               Paintable owner)
Component may want to delegate Tooltip handling to client. Layouts add Tooltip (description, errors) to caption, but some components may want them to appear one other elements too. Events wanted by this handler are same as in Tooltip.TOOLTIP_EVENTS

Parameters:
event -
owner -

addPngFix

public void addPngFix(com.google.gwt.user.client.Element el)
Adds PNG-fix conditionally (only for IE6) to the specified IMG -element.

Parameters:
el - the IMG element to fix

requestLayoutPhase

public void requestLayoutPhase()
Components can call this function to run all layout functions. This is usually done, when component knows that its size has changed.


setWindowName

public void setWindowName(String newName)
Reset the name of the current browser-window. This should reflect the window-name used in the server, but might be different from the window-object target-name on client.

Parameters:
stringAttribute - New name for the window.

captionSizeUpdated

public void captionSizeUpdated(Paintable component)

analyzeLayouts

public void analyzeLayouts()


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.