Oracle Fusion Middleware Tag Reference for Oracle ADF Faces 12c (12.2.1.4.0) E81455-03

# <af:dataFlavor>

dataFlavor dataflavor

The <af:dataFlavor> tag enables the page author to add an allowed `oracle.adf.view.rich.datatransfer.DataFlavor` to a drop target. The DataFlavor encapsulates a Java type that the drop target will accept as well as an additional discriminant on this Java type. DataFlavor discriminants allow page authors to set up drop targets that only accept drops from certain drag sources.

Multiple <af:dataFlavor> tags are allowed under a single drop target. A drop will be allowed if the drop contains any of the DataFlavors. The only valid parent tag of <af:dataFlavor> is <af:dropTarget> unless a component inherently accepts drops like the <af:panelDashboard> does, which would also make it a valid parent of the <af:dataFlavor> tag.

This example shows adding a DataFlavor on dropTarget to indicate drops of `java.util.Collection`s.

##

        <af:outputText id="objectDropTarget" value="Fire these developers:">
          <af:dropTarget actions="COPY" dropListener="#{TestDropHandler.handleCollectionFireDrop}">
            <af:dataFlavor flavorClass="java.util.Collection"/>
          </af:dropTarget>
        </af:outputText>

                This example shows using the discriminant attribute. The source is a collectionDragSource with model=fileModel.

         <af:outputText id="genericDropTarget" value="Drop a row here!" >
            <af:dropTarget actions="COPY" dropListener="#{demoDropHandler.handleDrop}">
               <af:dataFlavor flavorClass="org.apache.myfaces.trinidad.model.RowKeySet" discriminant="fileModel"/>
            </af:dropTarget>
         </af:outputText>

                This example shows a panelDashboard that accepts drops from outside of the panelDashboard into it.

                  <af:panelDashboard id="dashboard" dimensionsFrom="auto" dropListener="#{demoDashboard.move}">
                    <af:dataFlavor flavorClass="javax.faces.component.UIComponent"
                                      discriminant="fromSideBar"/>
                    ...
                    </af:panelDashboard>

    Attributes

        Name
        Type
        Supports EL?
        Description

    id
    String
    no

                    the identifier for the tag. The identifier must follow a subset of the syntax allowed in HTML:

                      Must not be a zero-length String
                      First character must be an ASCII letter (A-Za-z) or an underscore ('_')
                      Subsequent characters must be an ASCII letter or digit (A-Za-z0-9), an underscore ('_'), or a
                          dash ('-')

    flavorClass
    String
    no

                    The fully qualified Java class name for this DataFlavor.  If the drop contains
                    this DataFlavor, the drop target is guaranteed to be able to retrieve an Object
                    from the drop with this Java type using this DataFlavor.

                    While array types can be specified by appending square brackets to the type
                    (java.lang.Object[]), the rich client marshalling code doesn't
                    currently support array types other than Object[].

    discriminant
    String
    no

                    String discriminant used to further segregate the Java type system to prevent
                    undesired drops from occurring.  Take as an example, the case where there are two drag sources "A" and "B"
                    that both produce employees and two drop targets "alpha" and "beta" that both
                    consume employees. Assume the only legal drag combinations are A->alpha and
                    B->beta. The page author can declaratively specify this by setting A to
                    produce employees with the same DataFlavor discriminant that alpha accepts
                    and B to produce employees with the same DataFlavor discriminant that beta accepts.