javax.activation.ActivationDataFlavor Java Examples

The following examples show how to use javax.activation.ActivationDataFlavor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActivationDataFlavorConverter.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {
    final ActivationDataFlavor dataFlavor = (ActivationDataFlavor)source;
    final String mimeType = dataFlavor.getMimeType();
    if (mimeType != null) {
        writer.startNode("mimeType");
        writer.setValue(mimeType);
        writer.endNode();
    }
    final String name = dataFlavor.getHumanPresentableName();
    if (name != null) {
        writer.startNode("humanRepresentableName");
        writer.setValue(name);
        writer.endNode();
    }
    final Class representationClass = dataFlavor.getRepresentationClass();
    if (representationClass != null) {
        writer.startNode("representationClass");
        context.convertAnother(representationClass);
        writer.endNode();
    }
}
 
Example #2
Source File: CardTransfertHandler.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public CardTransfertHandler() {

		localObjectFlavor = new ActivationDataFlavor(DisplayableCard.class, DataFlavor.javaJVMLocalObjectMimeType,"DisplayableCard");
		window.add(dragLab);
		window.setBackground(new Color(0, true));

		DragSource.getDefaultDragSource().addDragSourceMotionListener(dsde -> {
			Point pt = dsde.getLocation();
			pt.translate(5, 5);
			window.setLocation(pt);
			window.setVisible(true);
			window.pack();
		});
	}
 
Example #3
Source File: ImageDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #4
Source File: ImageDataContentHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #5
Source File: ImageDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #6
Source File: ImageDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #7
Source File: ImageDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #8
Source File: ImageDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #9
Source File: ImageDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #10
Source File: ImageDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageDataContentHandler() {
    String[] mimeTypes = ImageIO.getReaderMIMETypes();
    flavor = new DataFlavor[mimeTypes.length];
    for(int i=0; i < mimeTypes.length; i++) {
        flavor[i] = new ActivationDataFlavor(Image.class, mimeTypes[i], "Image");
    }
}
 
Example #11
Source File: text_xml.java    From FairEmail with GNU General Public License v3.0 5 votes vote down vote up
@Override
   protected Object getData(ActivationDataFlavor aFlavor, DataSource ds)
			throws IOException {
if (aFlavor.getRepresentationClass() == String.class)
    return super.getContent(ds);
else if (aFlavor.getRepresentationClass() == StreamSource.class)
    return new StreamSource(ds.getInputStream());
else
    return null;        // XXX - should never happen
   }
 
Example #12
Source File: XmlDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #13
Source File: StringDataContentHandler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #14
Source File: StringDataContentHandler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #15
Source File: XmlDataContentHandler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #16
Source File: XmlDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #17
Source File: StringDataContentHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #18
Source File: XmlDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #19
Source File: StringDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #20
Source File: XmlDataContentHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #21
Source File: StringDataContentHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #22
Source File: ActivationDataFlavorConverter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public boolean canConvert(final Class type) {
    return type == ActivationDataFlavor.class;
}
 
Example #23
Source File: StringDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #24
Source File: XmlDataContentHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #25
Source File: StringDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #26
Source File: XmlDataContentHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}
 
Example #27
Source File: text_html.java    From FairEmail with GNU General Public License v3.0 4 votes vote down vote up
@Override
   protected ActivationDataFlavor[] getDataFlavors() {
return myDF;
   }
 
Example #28
Source File: text_xml.java    From FairEmail with GNU General Public License v3.0 4 votes vote down vote up
@Override
   protected ActivationDataFlavor[] getDataFlavors() {
return flavors;
   }
 
Example #29
Source File: StringDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ActivationDataFlavor getDF() {
    return myDF;
}
 
Example #30
Source File: XmlDataContentHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public XmlDataContentHandler() throws ClassNotFoundException {
    flavors = new DataFlavor[3];
    flavors[0] = new ActivationDataFlavor(StreamSource.class, "text/xml", "XML");
    flavors[1] = new ActivationDataFlavor(StreamSource.class, "application/xml", "XML");
    flavors[2] = new ActivationDataFlavor(String.class, "text/xml", "XML String");
}