protected void dispatchBehaviorEvent()

in myfaces-html5-core/src/main/java/org/apache/myfaces/html5/renderkit/behavior/DropTargetBehaviorRenderer.java [102:146]


    protected void dispatchBehaviorEvent(FacesContext context, UIComponent component,
            DropTargetBehavior dropTargetBehavior)
    {
        Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();

        // get value of param set in fx:dragSource
        String param = requestParameterMap.get(MYFACES_HTML5_DND_PARAM_MIME_TYPE);
        if (param == null || param.length() == 0)
            param = null;

        // get other data values with accepted mime types
        Map<String, String> dropDataMap = null;
        String strReceivedDataMimeTypes = requestParameterMap.get(MYFACES_DND_FOUND_MIME_TYPES_KEY);
        if (strReceivedDataMimeTypes != null && strReceivedDataMimeTypes.length() > 0)
        {
            dropDataMap = new HashMap<String, String>();

            //TODO: allow multiple values for mime-types
            //try with link DnDs
            String[] receivedDataMimeTypes = Html5RendererUtils.resolveStrings(strReceivedDataMimeTypes);
            for (String mimeType : receivedDataMimeTypes)
            {
                if (mimeType.equals(MYFACES_HTML5_DND_PARAM_MIME_TYPE))
                    // param is set already, pass
                    continue;

                String data = requestParameterMap.get(mimeType);
                if (data != null && data.length() > 0)
                {
                    dropDataMap.put(mimeType, data);
                }
            }
        }

        DropEvent event = new DropEvent(component, dropTargetBehavior, dropDataMap, param);

        // XXX: do we need immediate stuff on drop event?
        // PhaseId phaseId = dropTargetBehavior.isImmediate() || isComponentImmediate(component) ?
        // PhaseId.APPLY_REQUEST_VALUES :
        // PhaseId.INVOKE_APPLICATION;

        event.setPhaseId(PhaseId.INVOKE_APPLICATION);

        component.queueEvent(event);
    }