This section describes the API functions for populating the Components panel.

getComponentChildren()

Availability

Dreamweaver MX.

Description

This function returns a list of child ComponentRec objects for the active parent ComponentRec object. To load the root-level tree items, this function needs to read its metadata from its persistent store.

Arguments

{parentComponentRec}

The parentComponentRec argument is the componentRec object of the parent. If it is omitted, Dreamweaver expects a list of ComponentRec objects for the root node.

Returns

An array of ComponentRec objects.

Example

See function getComponentChildren(componentRec) in the WebServices.js file in the Configuration/Components/Common/WebServices folder.

getContextMenuId()

Availability

Dreamweaver MX.

Description

Returns the context menu ID for the component type. Every component type can have a context menu associated with it. The Context Menu pop-up menus are defined in the ComponentNameMenus.xml file, and they work the same way as the menu.xml file. The menu string can be static or dynamic. Keyboard shortcuts (accelerator keys) are supported.

Arguments

None.

Returns

A string defining the context menu ID.

Example

The following example sets the Options menu for the Components panel for CFCs associated with the Adobe ColdFusion server model.The example also defines the keyboard shortcuts for the menu:

 function getContextMenuId() 
{ 
    return "DWCFCsContext"; 
}

The DWWebServicesContext of the menu is defined in the file in the Configuration/Components/ColdFusion/CFCs/CFCsMenus.xml as follows:

 <menubar xmlns:MMString="http://www.macromedia.com/schemes/dat/string/" name="" id="DWCFCsContext"> 
    <menu MMString:name="Components/ColdFusion/CFCs/CFCsMenus_xml/DWContext_CFCs/menu/name" id="DWContext_CFCs"> 
    <menuitem MMString:name="Components/ColdFusion/CFCs/CFCsMenus_xml/DWContext_CFCs_createNewCFC/menuitem/name" domRequired="false" enabled="true" command="createCFC()" id="DWContext_CFCs_createNewCFC" /> 
    <menuitem MMString:name="Components/ColdFusion/CFCs/CFCsMenus_xml/DWContext_CFCs_editCode/menuitem/name" domRequired="false" enabled="canGetSelectedCFC()" command="editCFC();" id="DWContext_CFCs_editCode" /> 
<separator/> 
    <menuitem MMString:name="Components/ColdFusion/CFCs/CFCsMenus_xml/DWContext_CFCs_getDetails/menuitem/name" domRequired="false" enabled="canGetDetails()" command="getDetails()" id="DWContext_CFCs_getDetails" /> 
    <menuitem MMString:name="Components/ColdFusion/CFCs/CFCsMenus_xml/DWContext_CFCs_getDescription/menuitem/name" domRequired="false" enabled="canGetSelectedCFC()" command="getDescription()" id="DWContext_CFCs_getDescription" /> 
    <separator/> 
    <menuitem MMString:name="Components/ASP_NET_Csharp/Connections/ConnectionsMenus_xml/DWShortcuts_ServerComponent_Insert/menuitem/name" domRequired="false" enabled="insertCFCEnabled();" command="clickedInsertCFC();" id="DWShortcuts_ServerComponent_Insert" /> 
    </menu> 
</menubar>

getCodeViewDropCode()

Availability

Dreamweaver MX.

Description

This function gets the code that is either dragged, cut, or copied into the Code view from the Components panel.

Arguments

componentRec

  • The componentRec argument is an object.

Returns

The string that contains the code for the component.

Example

The following example identifies the code for an Adobe ColdFusion Component (CFC):

 function getCodeVi e wDropCode(compone nt  Rec ) 
{ 
    var codeToDrop=""; 
    if (componentRec) 
     { 
          if  (componentRec.objectType == "Connection") 
        { 
            v ar  connPart = new Participant("d at asource_tag"); 
            var paramObj = new Obje ct( ); 
            paramObj.datasource = componentRec.name; 
            codeToDrop =  con nPart.getInsertString(paramObj, "aboveHTML");} 
        el se if ((componentRec.objectType == "Column")| | 
                  (componentRec.objectType == "Paramete r ")) 
         { 
            c  odeToDrop = componentRec.dropcode; 
          } 
          e ls e{ 
            codeToDrop =  co mponentRec.name; 
            } 
        } 
        return codeToDrop; 
}

getSetupSteps()

Availability

Dreamweaver MX.

Description

Dreamweaver calls this function if the setupStepsCompleted() function returns zero or a positive integer. This function controls the server-side setup instructions, which can be implemented using extensions that use a modal dialog box and extensions that use server components.

This function returns an array of the strings for Dreamweaver to display in either the Setup Steps dialog box or the Components panel, depending on the extension type.

Arguments

None.

Returns

An array of n+1 strings, where n is the number of steps, as described in the following list:

  • The title that appears above the list of setup steps

  • For each step, the text instructions, which can include any HTML markup that is legal inside a li tag

    You can include links (a tags) in the list of steps by using the following form:

     <a href=”#” onMouseDown="handler">Blue Underlined Text</a>

    The "handler" value can be replaced by any of the following strings or any JavaScript expression, such as "dw.browseDocument('http://www.adobe.com')":

  • An "Event:SetCurSite" handler opens a dialog box to set the current site.

  • An "Event:CreateSite" handler opens a dialog box to create a new site.

  • An "Event:SetDocType" handler opens a dialog box to change the document type of the user’s document.

  • An "Event:CreateConnection" handler opens a dialog box to create a new database connection.

  • An "Event:SetRDSPassword" handler opens a dialog box to set the Remote Development Service (RDS) user name and password (Adobe ColdFusion only).

  • An "Event:CreateCFDataSource" handler opens the Adobe ColdFusion administrator in a browser.

Example

The following example sets four steps for Adobe ColdFusion components, and provides a hypertext link in the fourth step so the user can enter the RDS user name and password:

 function getSetupSteps() 
{ 
    var doSDK = false; 
    dom = dw.getDocumentDOM(); 
    if (dom && dom.serverModel) 
    { 
        var aServerModelName = dom.serverModel.getDisplayName(); 
    } 
    else 
    { 
        var aServerModelName = site.getServerDisplayNameForSite(); 
    } 
    if (aServerModelName.length) 
    { 
        if(aServerModelName != "ColdFusion") 
        { 
            if(needsSDKInstalled != null) 
            { 
                doSDK = needsSDKInstalled(); 
            } 
        } 
    } 
 
    var someSteps = new Array(); 
    someSteps.push(MM.MSG_WebService_InstructionsTitle); 
    someSteps.push(MM.MSG_Dynamic_InstructionsStep1); 
    someSteps.push(MM.MSG_Dynamic_InstructionsStep2); 
    if(doSDK == true) 
    { 
        someSteps.push(MM.MSG_WebService_InstructionsStep3); 
    } 
    someSteps.push(MM.MSG_WebService_InstructionsStep4); 
 
    return someSteps; 
}

setupStepsCompleted()

Availability

Dreamweaver MX.

Description

Dreamweaver calls this function before the Components tab appears. Dreamweaver then calls the getSetupSteps() function if the setupStepsCompleted() function returns zero or a positive integer.

Arguments

None.

Returns

An integer that represents the number of setup steps the user has completed, as described in the following list:

  • A value of either zero or a positive integer indicates the number of completed steps.

  • A value of -1 indicates that all the necessary steps are complete, so the instruction list does not appear.

handleDesignViewDrop()

Availability

Dreamweaver MX.

Description

Handles the drop operation when the user drags a table or view from the Databases panel or a component from the Components panel to the Design view.

Arguments

componentRec

  • The componentRec argument is an object that contains the following properties:

  • The name property is the name of the tree node item.

  • The image property is an optional icon for the tree node item. If omitted, Dreamweaver MX uses a default icon.

  • The hasChildren property is a Boolean value that indicates whether the tree node item is expandable: if true, Dreamweaver MX displays the Plus (+) and Minus (-) buttons for the tree node item; if false, the item is not expandable.

  • The toolTipText property is optional tool tip text for the tree node item.

  • The isCodeViewDraggable property is a Boolean value that indicates whether the tree node item can be dragged and dropped into the Code view.

  • The isDesignViewDraggable property is a Boolean value that indicates whether the tree node item can be dragged and dropped into the Design view.

Returns

A Boolean value that indicates whether the drop operation was successful: true if successful; false otherwise.

Example

The following example determines if the component is a table or view, and then returns the appropriate bHandled value:

 function handleDesignViewDrop(componentRec) 
{ 
    var bHandled = false; 
    if (componentRec) 
    { 
        if ((componentRec.objectType == "Table")|| 
            (componentRec.objectType == "View")) 
        { 
            alert("popup Recordset Server Behavior"); 
            bHandled = true; 
        } 
    } 
    return bHandled; 
}

handleDoubleClick()

Availability

Dreamweaver MX.

Description

When the user double-clicks the node in the tree, the event handler is called to allow editing. This function is optional. The function can return a false value, which indicates that the event handler is not defined. In this case, double-clicking causes the default behavior, which expands or collapses the tree nodes.

Arguments

componentRec

  • The componentRec argument is an object that contains the following properties:

  • The name property is the name of the tree node item.

  • The image property is an optional icon for the tree node item. If this icon is omitted, Dreamweaver uses a default icon.

  • The hasChildren property is a Boolean value that indicates whether the tree node item is expandable: if true, Dreamweaver displays the Plus (+) and Minus (-) buttons for the tree node item; if false, the item is not expandable.

  • The toolTipText property is an optional tooltip text for the tree node item.

  • The isCodeViewDraggable property is a Boolean value that indicates whether the tree node item can be dragged and dropped into Code view.

  • The isDesignViewDraggable property is a Boolean value that indicates whether the tree node item can be dragged and dropped into Design view.

Returns

Nothing.

Example

In the following example, the extension has a chance to handle a double-click on the tree node item; if it returns the value false, the default behavior is to expand/collapse the nodes.

 function handleDoubleClick(componentRec) 
{ 
    var selectedObj = dw.serverComponentsPalette.getSelectedNode(); 
    if(dwscripts.IS_WIN) 
    {     
        if (selectedObj && selectedObj.wsRec && selectedObj.wsRec[ProxyGeneratorNamePropName]) 
        { 
            if (selectedObj.objectType == "Root") 
            { 
                editWebService(); 
                return true; 
            } 
            else if (selectedObj.objectType == "MissingProxyGen") 
            { 
                displayMissingProxyGenMessage(componentRec);             
                editWebService(); 
                return true; 
            } 
        } 
    } 
    return false; 
}

toolbarControls()

Availability

Dreamweaver MX.

Description

Every component type returns a list of toolBarButtonRec objects, which represents the toolbar icons, in left-to-right order. Each toolBarButtonRec object contains the following properties:

Property name

Description

image

Path to image file

disabledImage

Optional; path to disabled image searches for the toolbar button

pressedImage

Optional; path to pressed image searches for the toolbar button

toolTipText

Tooltip for the toolbar button

toolStyle

Left/right

enabled

JavaScript code that returns a Boolean value (true or false). The enablers are called when the following conditions exist:

  • When the dreamweaver.serverComponents.refresh() function is called

  • When the selection in the tree changes

  • When server model changes

command

The JavaScript code to execute. The command handler can force a refresh using the dreamweaver. serverComponents.refresh() function.

menuId

The unique menu ID for the pop-up menu button when the button is clicked. When this ID is present, it overrides the command handler. In other words, the button can be either a button associated with a command, or a button that has a pop-up menu associated with it, but not both at the same time.

Arguments

None.

Returns

An array of toolbar buttons in left-to-right order.

Example

The following example assigns properties to the toolbar buttons:

 function toolbarControls() 
{ 
    var toolBarBtnArray = new Array(); 
    dom = dw.getDocumentDOM(); 
    var plusButton = new ToolbarControlRec(); 
    var aServerModelName = null; 
    if (dom && dom.serverModel) 
    { 
        aServerModelName = dom.serverModel.getDisplayName(); 
    } 
    else 
    { 
        //look in the site for potential server model 
        aServerModelName = site.getServerDisplayNameForSite(); 
    } 
    if (aServerModelName.length) 
    { 
        if(aServerModelName == "ColdFusion") 
        { 
            plusButton.image           = PLUS_BUTTON_UP; 
            plusButton.pressedImage    = PLUS_BUTTON_DOWN; 
            plusButton.disabledImage   = PLUS_BUTTON_UP; 
            plusButton.toolStyle       = "left"; 
            plusButton.toolTipText    = MM.MSG_WebServicesAddToolTipText; 
            plusButton.enabled        = "dwscripts.IS_WIN"; 
            plusButton.command        = "invokeWebService()"; 
        } 
        else 
        { 
            plusButton.image          = PLUSDROPBUTTONUP; 
            plusButton.pressedImage   = PLUSDROPBUTTONDOWN; 
            plusButton.disabledImage  = PLUSDROPBUTTONUP; 
            plusButton.toolStyle      = "left"; 
            plusButton.toolTipText    = MM.MSG_WebServicesAddToolTipText; 
            plusButton.enabled        = "dwscripts.IS_WIN"; 
            plusButton.menuId         = "DWWebServicesChoosersContext"; 
        } 
        toolBarBtnArray.push(plusButton); 
 
        var minusButton            = new ToolbarControlRec(); 
        minusButton.image          = MINUSBUTTONUP; 
        minusButton.pressedImage   = MINUSBUTTONDOWN; 
        minusButton.disabledImage  = MINUSBUTTONDISABLED; 
        minusButton.toolStyle      = "left"; 
        minusButton.toolTipText    = MM.MSG_WebServicesDeleteToolTipText; 
        minusButton.command        = "clickedDelete()"; 
        minusButton.enabled  = "(dw.serverComponentsPalette.getSelectedNode() != null && 
            dw.serverComponentsPalette.getSelectedNode() && 
            ((dw.serverComponentsPalette.getSelectedNode().objectType=='Root') || 
            (dw.serverComponentsPalette.getSelectedNode().objectType == 'Error') || 
            (dw.serverComponentsPalette.getSelectedNode().objectType == 
            'MissingProxyGen')))"; 
        toolBarBtnArray.push(minusButton); 
 
        if(aServerModelName != null && aServerModelName.indexOf(".NET") >= 0) 
        { 
            var deployWServiceButton           = new ToolbarControlRec(); 
            deployWServiceButton.image         = DEPLOYSUPPORTBUTTONUP; 
            deployWServiceButton.pressedImage  = DEPLOYSUPPORTBUTTONDOWN; 
            deployWServiceButton.disabledImage = DEPLOYSUPPORTBUTTONUP; 
            deployWServiceButton.toolStyle     = "right"; 
            deployWServiceButton.toolTipText   = MM.MSG_WebServicesDeployToolTipText; 
            deployWServiceButton.command  = "site.showTestingServerBinDeployDialog()"; 
            deployWServiceButton.enabled  = true; 
            toolBarBtnArray.push(deployWServiceButton); 
        } 
        //add the rebuild proxy button for windows only. 
        //bug 45552: 
        if(navigator.platform.charAt(0) !="M") 
        { 
            var proxyButton            = new ToolbarControlRec(); 
            proxyButton.image          = PROXYBUTTONUP; 
            proxyButton.pressedImage   = PROXYBUTTONDOWN; 
            proxyButton.disabledImage  = PROXYBUTTONDISABLED; 
            proxyButton.toolStyle      = "right"; 
            proxyButton.toolTipText    = MM.MSG_WebServicesRegenToolTipText; 
            proxyButton.command        = "reGenerateProxy()"; 
            proxyButton.enabled        = "enableRegenerateProxyButton()"; 
            toolBarBtnArray.push(proxyButton); 
        } 
    } 
    return toolBarBtnArray; 
}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy