Skip to main content

D2SV Object On Click Sample

Object on click actions extension provides option override the default action on the object. With this default action for an object can be controlled with a predicate condition. So default action can be defined based on rules.

This sample shows

  • How to customize the default action for an object.

Instruction to try out the sample

  • Build the plugin using npm run build from SDK workspace root.
  • Copy D2SV-Object-OnClick-Actions-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.
  • Login into D2-Smartview and navigate to any Doclist widget view.
  • Execute default action for PDF file and content less object.
  • While executing default action for .txt document, Modal alert will be shown.
  • While executing default action for .png document, Toast message will be shown.

Source code structure

D2SV-Object-OnClick-Actions
| pom.xml
|
+---src
| \---main
| +---java
| | \---com
| | +---emc
| | | D2PluginVersion.java
| | |
| | \---opentext
| | \---d2
| | +---rest
| | | \---context
| | | \---jc
| | | PluginRestConfig_ObjectOnClickActions.javations.javal.java
| | |
| | \---smartview
| | \---objectonclickactions
| | | ObjectOnClickActionsPlugin.java
| | |
| | +---api
| | | ObjectOnClickActionsVersion.java
| | |
| | \---rest
| | package-info.java
| |
| +---resources
| | | D2Plugin.properties
| | | objectonclickactions-version.properties
| | |
| | \---smartview
| | SmartView.properties
| |
| \---smartview
| | .csslintrc
| | .eslintrc-html.yml
| | .eslintrc.yml
| | .npmrc
| | config-editor.js
| | Gruntfile.js
| | objectonclickactions.setup.js
| | package.json
| | server.conf.js
| |
| +---src
| | | component.js
| | | config-build.js
| | | Gruntfile.js
| | | objectonclickactions-extensions.json
| | | objectonclickactions-init.js
| | |
| | +---bundles
| | | objectonclickactions-bundle.js
| | |
| | +---commands
| | | | open.modal.alert.js
| | | | open.toast.message.js
| | | |
| | | \---nls
| | | | lang.js
| | | |
| | | \---root
| | | lang.js
| | |
| | +---extensions
| | | object.onclick.actions.rules.js
| | |
| | +---test
| | | extensions.spec.js
| | |
| | \---utils
| | | startup.js
| | |
| | \---theme
| | | action.icons.js
| | |
| | \---action_icons
| | action_sample_icon.svg

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.

D2SV Custom Default Actions Sample
  • src/main/smartview/src/extensions/object.onclick.actions.rules.js - Defined ruled for on click action of a document.
  • src/main/smartview/src/commands/open.modal.alert.js - Sample command for executing object on-click action with modal alert.
  • src/main/smartview/src/commands/open.toast.message.js - Sample command for executing object on-click action with toast message.