Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-2674

[DMN Designer] Multiple DRDs support - Context menu component

XMLWordPrintable

    • 2020 Week 28-30 (from Jul 6)

      Goal: Once the context menu is triggered, it must show options for a contextual action.

      Implementation details: Basically, this widget is going to be as simple and generic, as possible. This is because it is so common, that in future we could have more use cases, where a context menu is needed.

      Let me describe its APIs via an utilization example:

      @EventHandler("trigger-context-menu")
      public void triggerContextMenu(final ClickEvent event) {
          mainTree.appendChild(dRDContextMenu.getElement());
          dRDContextMenu.resetMenuItems();
          dRDContextMenu.setHeaderMenu("DRD ACTIONS", "fa fa-share-alt");
          dRDContextMenu.addTextMenuItem("Create", true, () -> DomGlobal.console.log("Creates a new DRD with the selected node"));
          dRDContextMenu.addTextMenuItem("Add to", true, () -> DomGlobal.console.log("Adds a node the the selected DRD"));
          dRDContextMenu.addTextMenuItem("Remove", true, () -> DomGlobal.console.log("Removes the node from the current DRD (it corresponds to the same action in the trash icon)"));
          dRDContextMenu.show();
      }
      
      1. The position of the widget will be decided by the container, in which the widget will be instantiated. 
      2. resetMenuItems method, it useful to clear all items belonging to such menu context instance.
      3. setHeaderMenu method, it is used to set the menu header. It accepts two parameters: the header title and the header CSS class menu (you can use font awesome classes).
      4. addTextMenuItem method, it is used to populate menu items list. It accepts item title, a boolean to set if such item is enabled or not, and a command to be executed when such item is clicked.
      5. show() and hide() methods, for widget visibility.

       Note: The context menu widget can be extended to support different kind of menu item, for example multi-level items, or items that contain icons.

            vpellegr Valentino Pellegrino (Inactive)
            karreiro_ Guilherme Gomes (Inactive)
            Jozef Marko Jozef Marko
            Jozef Marko Jozef Marko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: