< Day Day Up > |
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}
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. Shortcut keys (accelerator keys) are supported. Arguments None. Returns A string defining the Context Menu ID. Example The following example sets the menu options for the Components panel for web services associated with the ASP.NET/C# server model and defines the shortcut keys for that menu: function getContextMenuId() { return "DWWebServicesContext"; } Where DWWebServicesContext is defined in the file in the Configuration/Components/ASP.NET_CSharp/WebServices/WebServicesMenus.xml as follows: <shortcutlist > <shortcut key="Del" domRequired="false" enabled="(dw.serverComponentsPalette .getSelectedNode() != null && (dw.serverComponentsPalette.getSelectedNode() .objectType=='Root'))" command="clickedDelete();" /> </shortcutlist> <menubar name="" > <menu name="Server Component Popup" > <menuitem name="Edit Web Service" domRequired="false" enabled="dw .serverComponentsPalette.getSelectedNode() != null && (dw.serverComponentsPalette .getSelectedNode().objectType=='Root') && dw.serverComponentsPalette.getSelectedNode() .wsRec != null && dw.serverComponentsPalette.getSelectedNode().wsRec.ProxyGeneratorName != null" command="editWebService()" /> ... </menubar> getCodeViewDropCode()Availability Dreamweaver MX. Description This function gets the code that is dragged and dropped in Code view from the Components panel or the code that is cut, copied, or pasted from the Components panel. Arguments componentRec
Returns The string that contains the code for the component. Example The following example identifies the code for a common web service: function getCodeViewDropCode(componentRec) { var codeToDrop=""; if (componentRec) { if (componentRec.objectType=="Class") { codeToDrop = dw.getExtDataValue("webservices_constructor","insertText"); codeToDrop = codeToDrop.replace(RegExp("@@Id@@","g"),componentRec.name); codeToDrop = codeToDrop.replace(RegExp("@@Class@@","g"),componentRec.name); } else if (componentRec.objectType=="Method") { codeToDrop = componentRec.dropCode; } if(componentRec.dropCode) { codeToDrop = componentRec.dropCode; } else { codeToDrop = componentRec.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:
You can include hypertext 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.macromedia.com')":
Example The following example sets four steps for 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:
handleDesignViewDrop()Availability Dreamweaver MX. Description Handles the drop operation when the user drags a table or view from the Database panel or a component from the Components panel to the Design view. Arguments componentRec
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
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:
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; } |
< Day Day Up > |