# Drag & Drop

Drag & Drop functionality can be activated in the CoreEngine via layouts can be configured. The basic procedure is that If you select components of a layout and assign an actor of type assigns utils.dragAndDrop.drag-and-drop-options. The component can be via this actor as start element for drag operations, as target element can be configured for drag operations or as both. Using additional parameters on the actor, the operation to be executed is defined for the `Drop on a valid target is defined.

Components that can be used for Drag & Drop are particularly suitable for data object. Such a data object is called a data object in the 'CoreEngine'. usually be a 'BaseBean'. As an example here are among others to name the ItemRenderer of lists (e.g. in a main view) The However, implementation of the 'drag and drop' functionality provides that any data objects can be dragged and dropped. Therefore, there is currently only a limited selection of components, that support Drag & Drop. See draganddrop_components.

# Components

The following components currently support Drag & Drop:

  • components.lists.default-base-bean-tile-list-item-renderer
  • com.com4ap.ce.global.tree.base-bean-tree-item-renderer
  • components.lists.ceobject-list-item-renderer

# Long Drag Over

Some components also support the 'Long Drag' functionality Over'. Here, as soon as a dragged element is over the Component is held, a special function is called. Each Component reacts differently.

Component-Name Reaction
BaseBeanTreeItemRenderer Opens the node of the corresponding 'com.cm4ap.base.tree.tree-component
ModuleMenu Reacts differently, depending on which element the mouse is over within the 'ModuleMenu'. If the mouse is over the Open button, the 'ModuleMegaMenu' is opened. If the mouse is over one of the module names, the Main-View of this module is opened.
ModuleMegaMenu If the mouse is over one of the module names, the main view of the module is opened.

# Example

Assuming that there is an action in the CoreEngine module account called addd_contact, the drag and drop functionality could be that contacts can be made by pulling and dropping a company (via the action add_contact) can be added.

For this purpose, adjustments have to be made to two layouts. On the one hand it must be ensured that the contacts can be pulled. At Main layout of the contact module must be adjusted as follows will be:

  • A new Actor must be added:

    <actor id="dragAndDropOptions" type="DragAndDropOptions">
        <parameter>
            <entry class="map" key="drag">
                <entry class="boolean" key="enabled">true</entry>
                <entry class="boolean" key="showObjectImage">false</entry>
                <entry class="boolean" key="showLabel">true</entry>
            </entry>
        </parameter>
    </actor>
    
  • It must be available to the ItemRenderer via the ItemRendererFactory using the parameter itemRendererProperties of the actor can be assigned:

    <entry key="itemRendererProperties" class="map">
        <entry key="dragAndDropOptions" class="actor">dragAndDropOptions</entry>
    </entry>
    

Through these changes the contact dragable.

The other adjustment takes place in the main layout of the account module. There the matching counterpart is configured, which is the drawn can receive contacts:

  • Here a Drag and DropOptions actor must be configured as well:

    <actor id="dragAndDropOptions" type="DragAndDropOptions">
        <parameter>
            <entry class="array" key="drop">
                <value class="map">
                    <entry class="string" key="moduleName">contact</entry>
                    <entry class="string" key="actionName">add_contact</entry>
                </value>
            </entry>
        </parameter>
    </actor>
    
  • Then the actor is added to the `contact module, as in the ItemRenderer assigned:

    <entry key="itemRendererProperties" class="map">
        <entry key="dragAndDropOptions" class="actor">dragAndDropOptions</entry>
    </entry>
    

Via the parameter moduleName the module is specified whose BaseBeans can be accepted as drop. In this case contact. At actionName specifies the name of the action to be executed should. The actionName parameter specifies the action that is to be executed. is supposed to be.

Further possibilities for parameterization can be given to the Parameter description of the utils.dragAndDrop.drag-and-drop-options can be removed.

Request missing documentation