<af:dataFlavor>

dataFlavor data flavor


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>.

Examples

This example shows adding a DataFlavor on dropTarget to indicate drops of java.util.Collections.

<source>
              <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>
            

</source>

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

<source>
               <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>
            

</source>

Attributes

Name Type Supports EL? Description
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.