Skip to main content

D2SV Custom Dialogs(D2FS) sample

D2 Custom Dialog sample provide an option to modify the metadata for a document with any available properties page created in D2-Config. As out of the box, the document metadata can be modified only using the properties page which is resolved after configuration matrix against the context.

This sample shows

  • How to define a D2 Dialog service plugin which implements ID2fsPlugin.
  • How to define a D2FS state method to make dialog chaining as context less. So that the last step Submit will be performed on OOTB property dialog service instead of original dialog service.

Instruction to try out the sample

  • Build the plugin using npm run build from SDK workspace root.
  • Copy D2SV-Custom-Dialogs-1.0.0.jar from 'dist' folder in workspace root and paste it inside WEB-INF/lib folder of a deployed D2 Smartview application.
  • Restart application server on which D2 Smartview is deployed.
  • Open D2-Config web application in browser, login and then create few properties page configuration.
  • Login into D2-Smartview and navigate to any Doclist widget view.

Show advance properties

  • Select an object and locate & click menu item Show advance properties from the selection toolbar to open Selective property page view dialog.
  • In the Select view dropdown, choose any property page name and click Show button.
  • The dialog should show selected object's metadata as per the selected property page name.

Preview Dialog Fields

  • Select an object and locate & click menu item Preview Dialog Fields from the selection toolbar to open Preview Dialog Fields dialog.
  • The dialog should show dialog fields that are supported with examples including examples for Java assistance support.

Source code structure

D2SV-Custom-Dialogs
|
| pom.xml
|
+---src
| \---main
| +---java
| | \---com
| | +---emc
| | | D2PluginVersion.java
| | |
| | \---opentext
| | \---d2
| | +---rest
| | | \---context
| | | \---jc
| | | PluginRestConfig_D2SVDialogs.java
| | |
| | \---smartview
| | \---d2svdialogs
| | | D2SVDialogsPlugin.java
| | |
| | +---api
| | | D2SVDialogsVersion.java
| | |
| | +---dialogs
| | | SelectivePropertyDisplay.java
| | | PreviewDialogFields.java
| | |
| | +---assistance
| | | CountryAssistance.java
| | | StateAssistance.java
| | | CityAssistance.java
| | | RadioFieldAssistance.java
| | | LanguageAssistance.java
| | \---utils
| | | DataUtils.java
| | |
| | +---rest
| | | package-info.java
| | |
| | \---webfs
| | \---dialog
| | D2DialogServicePlugin.java
| |
| +---resources
| | | D2Plugin.properties
| | | d2svdialogs-version.properties
| | |
| | +---smartview
| | | SmartView.properties
| | |
| | +---strings
| | | +---dialog
| | | | \---SelectivePropertyDisplay
| | | | SelectivePropertyDisplay_en.properties
| | | | \---PreviewDialogFields
| | | | PreviewDialogFields_en.properties
| | | |
| | | \---menu
| | | \---MenuContext
| | | MenuContext_en.properties
| | |
| | \---xml
| | +---dialog
| | | SelectivePropertyDisplay.xml
| | | PreviewDialogFields.xml
| | |
| | \---unitymenu
| | MenuContextDelta.xml
| |
| \---smartview
| | .csslintrc
| | .eslintrc-html.yml
| | .eslintrc.yml
| | .npmrc
| | config-editor.js
| | d2svdialogs.setup.js
| | Gruntfile.js
| | package.json
| | server.conf.js
| |
| +---src
| | | component.js
| | | config-build.js
| | | d2svdialogs-extensions.json
| | | d2svdialogs-init.js
| | | Gruntfile.js
| | |
| | +---bundles
| | | d2svdialogs-bundle.js
| | |
| | +---dialogs
| | | \---d2fs
| | | context.less.d2fs.state.method.js
| | |
| | +---extensions
| | | dialog.state.methods.js
| | |
| | +---test
| | | extensions.spec.js
| | |
| | \---utils
| | | startup.js
| | |
| | \---theme
| | | action.icons.js
| | |
| | \---action_icons
| | action_sample_icon.svg
| |
| \---test
| Gruntfile.js
| karma.conf.js
|
\---target

Files and their purpose

Following are the list of function oriented source files and their purpose. Other source files present within the plugin are part of common infrastructure code and explained in Understanding D2SV plugin project.

Java Classes
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/dialogs/SelectivePropertyDisplay.java - Dialog class which implements ID2Dialog to serve the dialog for selecting the properties page configuration.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/webfs/dialog/D2DialogServicePlugin.java - Dialog service class which implements ID2fsPlugin interface for validating the dialog request.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/dialogs/PreviewDialogFields.java - Dialog class which implements ID2Dialog to serve the dialog for previewing the dialog fields.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/assistance/utils/DataUtils.java - Data utility class to retrieve sample data for java assistance example implementation.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/assistance/CountryAssistance.java - Assistance class which implements IJavaAssistance to serve the data for Java assistance to display sample country data.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/assistance/StatesAssistance.java - Assistance class which implements IJavaAssistance to serve the data for states field based on selected country.
  • src/main/java/com/opentext/d2/smartview/d2svdialogs/assistance/CityAssistance.java - Assistance class which implements IJavaAssistance to serve the data for city field based on multiple selected states in the dialog.
Dialog form definition
  • src/main/resources/xml/dialog/SelectivePropertyDisplay.xml - Defines the form structure for rendering "SelectivePropertyDisplay" dialog. The same file will be processed in "src/main/java/com/opentext/d2/smartview/d2svdialogs/dialogs/SelectivePropertyDisplay.java"
  • src/main/resources/strings/dialog/SelectivePropertyDisplay/SelectivePropertyDisplay_en.properties - Label associated with the dialog.
  • src/main/resources/xml/dialog/PreviewDialogFields.xml - Defines the form structure for rendering "PreviewDialogFields" dialog. The same file will be processed in "src/main/java/com/opentext/d2/smartview/d2svdialogs/dialogs/PreviewDialogFields.java"
  • src/main/resources/strings/dialog/PreviewDialogFields/PreviewDialogFields_en.properties - Label associated with the dialog.
Custom dialog menu configuration in back-end
  • src/main/resources/strings/menu/MenuContext/MenuContext_en.properties - Labels associated with the dynamically configured menu.
  • src/main/resources/xml/unitymenu/MenuContextDelta.xml - The menu definition file that dynamically adds a new type(MenuContext) of menu for the D2FS D2MenuService to discover and return for D2 Smartview.
Dialog state method override

As part of dialog state customization added extension for dialog state methods. This state method will be resolved based on "SelectivePropertyDisplay" dialog name. Intension of having custom dialog state method to override the default behavior of dialog state. With this override dialog state is decoupled between first form and second form.

  • src/main/smartview/src/dialogs/d2fs/context.less.d2fs.state.method.js - This is a client side JavaScript file extends "d2/sdk/controls/dialogs/generic/d2fs.state.method". Dialog context is decoupled by having dummy override for "setDialogContextForm()" method.
  • src/main/smartview/src/extensions/dialog.state.methods.js - This file is having rule for resolving the dialog state method based on dialog name.
  • src/main/smartview/src/d2svdialogs-extensions.json - Adding the rule for dialog.state.method.
  "d2/sdk/controls/dialogs/generic/dialog.state.methods": {
"extensions": {
"d2svdialogs": [
"d2svdialogs/extensions/dialog.state.methods"
]
}
}