pp108 : AppPalette

AppPalette


AppPalette is a sub-application that is loaded inside another application. An appPalette can be loaded in an application using the loadAppPalette() or loadAppPaletteContent() methods. An appPalette is an application by itself and, when loaded using the above method, possesses a life cycle same as that of an application. Loaded appPalettes can be accessed from the appPalettes collection of the application object.

The various properties and methods defined for appPalettes are as follows:

Table 1. List of Properties

Properties

Description

automatic

Optional. Denotes whether or not the content of an App Palette is loaded, when a Web page containing the App Palette is loaded for the first time. Possible values are:

  • true: Default. App Palette content is loaded when the Web page is loaded for the first time.
  • false: App Palette content is not loaded initially. It is loaded only when the user clicks the App Palette.

dockable

Optional. Denotes whether or not an appPalette is docked to a region when dragged to it. Possible values are:

  • true: Default. App Palette can be docked to regions.
  • false: App Palette cannot be docked to regions.

registerViewAs

Optional. Denotes whether an appPalette can be registered in the View Manager ( menu in the toolbar of an App Palette) or not. By default, all appPalettes that can be closed are registered. Possible values are:

  • self: appPalette is registered as direct item in options menu.
  • none: appPalette is not registered in view manager.
    If any other value is assigned, it is considered as a group name, that is multiple appPalettes with the same name (other thanselfornone) are considered part of a single group.


Table 2. List of Methods

Method

Description

close()

Closes the appPalette.

dock()

Positions the appPalette in the docked mode in an Application.In the docked mode, the appPalette is attached to a docking area along the four borders of the region. If no region is specified, the appPalette will be in the floating mode.

getCaption()

Gets the current caption of the appPalette defined in the AppPalette Definition.

getTitle()

Gets the current title of the appPalette. The title is a combination of <caption> and <description> if they are different, or just <caption> if they are the same.

hide()

Hides the appPalette if it is visible.

show()

Displays the appPalette if it is hidden.

setCaption()

Sets the caption of the appPalette.

setTitle(sCaption, sDescription)

Sets the title of the appPalette. A title is a combination of caption and description (caption-description).

undock()

Undocks the appPalette object to the floating mode. In the floating mode, the appPalette can appear anywhere on the application and must have a title bar for identification.



For an appPalette other than static HTML appPalette, the isAppPaletteClosable() method can be implemented and must return boolean when called. The isAppPaletteClosable() method is called by the host application when it is being closed. If any of the appPalettes in the application returnfalse, then the application and the appPalettes will not be closed.

AppPalette Definition

<script id="testAppPaletteUIApplication" type="cordys/xml">
    <Application display="visible" focus="true" registerViewAs="Group Name">
        <id>testAppPaletteUI</id>
        <url>/cordys/wcp/test/library/ui/testcollapsible.htm</url>
        <description>App Palette UI</description>
        <caption>App Palette</caption>
        <region docked="false">rightRegion</region>
    </Application>
</script>


Note: If the inPreferences attribute is set to true in the Application tag of an AppPalette definition, then on closing the application, the state of the appPalette is stored as preferences and is retained the next time you open the application.