Update Chooser Widget

The File Chooser Widget provides a way of updating the installation files/software from the desktop. This widget is based on the Prototype JavaScript library.

Features

  • Allows users to update installed applications

How to use

Add this code to the head section of the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<style type="text/css" title="currentStyle" media="screen">
 @import '<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "theme","app","css.jsp?externalApp=true")%>';
</style>
<script src='/dekohportal/dwr/engine.js'></script>
<script src='/dekohportal/dwr/util.js'></script>
<script type="text/javascript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "common",null,"JSlibrary.jsp")%>"></script>
<script type='text/javascript' src='<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","updateChooser","updateChooser.js")%>'>
</script>
<script type="text/javascript" src="<%=dekoh.portal.util.StaticFilesURLGenerator.generateStaticFileURL(request, "widget","dialog","dialog.js")%>">
</script>

HTML code

Include the following code where you want to invoke the File Chooser in page:
<input type="button" value="Find Updates" onclick="new UpdateChooser();"/>

Parameters for initializing the Update Chooser class

Required parameters

None

Optional parameters

OptionsSinceDescriptionDefault
classNameV1.0The style classDekoh
titleV1.0Set the title here‘Update Chooser’
topMessageV1.0The top message on the dialog'Pick a template that suits your collection'
resizableV1.0Allow the dialog to resize value is set to true or falsefalse
widthV1.0Width of the dialog520
heightV1.0Height of the dialog400
xPosV1.0Specify the x position of the dialog in the document 0
yPosV1.0Specify the y position of the dialog in the document0
minimizableV1.0Works with resizable value set to ‘true’. The value defined for this is ‘true’ or ‘false’ depends on whether you want to make dialog minimized False
maximizableV1.0Works with resizable value set to ‘true’. The value defined for this is ‘true’ or ‘false’ depends on whether you want to make dialog maximizedFalse
isModalV1.0Specify whether the dialog is modal or nottrue-

Functions

FunctionParametersDescription
findComponents-Get the components installed on the system
displayComponents-Display all the components of the desktop
checkUpdates-Finds all the update on the installed apps
enableDekohRestart-Enable the restart button
disableDekohRestart-Disable the restart button
findNoUpdates-Find all the app list which are not to be updated
showAll-Show all the app in the dialog
progressBarId, Name, progressWidth, percentSet the progress bar for the software getting installed
displayUpdates-Display all the updates
chkDownloadidCheck whether the app is downloaded or not and find the dependencies
componentProgressidCheck the components which are dependent on the parent app
DependentsProgressId, progidGet the progress of the dependent components
showDependents-Show the dependent component
shutdown-Shutdown the server

DWR Implementation

The DWR method mapping XML is provided in the web.xml file.
<init-param>
            <param-name>config-updatechooser</param-name>
            <param-value>widgets/updateChooser/dwr-updateChooser.xml</param-value>
</init-param>

DWR XML

<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 1.0//EN"
    "http://www.getahead.ltd.uk/dwr/dwr10.dtd">
<dwr>
    <allow>
	<create creator="new" javascript="updatechooser">
            <param name="class" value="dekoh.portal.widget.updatechooser.UpdateChooserUtil"/>
            <include method="initUpdateChooser"/>
            <include method="getPercentage"/>
            <include method="getUpdates"/>
            <include method="findInstalledApps"/>
            <include method="getDependencies"/>
            <include method="updateComponent"/>
            <include method="updateDependency"/>
            <include method="findpendingApps"/>
            <include method="findOngoingApps"/>
            <include method="getComponentDependencyProgress"/>
            <include method="getComponentProgress"/>
            <include method="getNoUpdatesList"/>
            <include method="resetNoUpdatesList"/>
            <include method="updateChooserClose"/>
        </create>  
         <convert converter="bean" match="dekoh.portal.widget.updatechooser.UpdateObject"/>
         <convert converter="bean" match="dekoh.portal.widget.updatechooser.ComponentObject"/>
         <convert converter="bean" match="dekoh.portal.widget.updatechooser.DependencyDataObject"/>
         <convert converter="bean" match="dekoh.portal.widget.updatechooser.ResolvedResult"/>
    </allow>
</dwr>

Converters

We need to ensure that all the parameters can be converted. Many of the types provided by the JDK are enabled for you, but you need to give DWR permission to convert your own bean. Generally this means that JavaBean parameters will need a <convert ...> entry.
  • Convert-class: dekoh.portal.widget.updatechooser.UpdateObject
  • Description: JavaBean to holding the information about the updatable component information.
  • Convert-class: dekoh.portal.widget.updatechooser.ComponentObject
  • Description: JavaBean to holding the information about the current updating component.
  • Convert-class: dekoh.portal.widget.updatechooser.DependencyDataObject
  • Description: JavaBean to holding the information about the component dependencies.
  • Convert-class: dekoh.portal.widget.updatechooser.ResolvedResult
  • Description: JavaBean to holding the information about the component resolvable dependencies.

Creators

Each class on which we execute methods, needs a <create ...> entry. There are several types of creator. The most common ones use either the 'new' keyword or the Spring framework. For more information, see the Creator documentation.
  • ClassName: dekoh.portal.widget.updatechooser.UpdateChooserUtil
  • Description: Class will provide the functionality to find and update installed components on dekoh.

Methods-functionality

Method NameFunctionality
findInstalledAppsGets the list all installed components on the accessing dekoh desktop.
findpendingAppsGets the all pending components to be installed.
getUpdatesGets the available updates to the given component.
getDependenciesGets the list of dependencies available on the given component else empty resolve set.
setUserViewPreferenceSets the user viewing preference (list or thumb nail view).
updateDependencyUpdates the dependencies to the given component.
updateComponentUpdates the given component.
GetComponentProgressGets the current update progress status for the given component.
GetComponentDependencyProgressGets the current update progress status of dependencies of the given component.

Availability

Dekoh Portal Ver 0.4.2 or later.

Attachments