List of usage examples for com.vaadin.util FileTypeResolver getMIMEType
public static String getMIMEType(File file)
From source file:com.cms.utils.FileDownloader.java
License:Apache License
@Override public String getMIMEType() { return FileTypeResolver.getMIMEType(sourceFile); }
From source file:com.haulmont.cuba.web.toolkit.VersionedThemeResource.java
License:Apache License
@Override public String getMIMEType() { return FileTypeResolver.getMIMEType(super.getResourceId()); }
From source file:info.magnolia.filesystembrowser.app.action.availability.IsImageRule.java
License:Open Source License
@Override protected boolean isAvailableForItem(Object itemId) { if (itemId instanceof File) { String mimeType = FileTypeResolver.getMIMEType((File) itemId); return (mimeType != null && mimeType.matches("image.*")); }/*from ww w.j av a 2s. c o m*/ return false; }
From source file:info.magnolia.filesystembrowser.app.imageprovider.FSImageProvider.java
License:Open Source License
@Override public Object getThumbnailResource(Object itemId, String generator) { if (itemId instanceof File) { File file = (File) itemId; if (file.exists()) { String mimeType = FileTypeResolver.getMIMEType(file); if (mimeType != null && mimeType.matches("image.*")) { Resource imageResource = scaleImage(file); return imageResource; } else { Resource resolvedThumbnail = FileTypeResolver.getIcon(file); return resolvedThumbnail == null ? FileTypeResolver.DEFAULT_ICON : resolvedThumbnail; }//from w w w. ja va 2 s . c om } } return null; }
From source file:org.lucidj.vaadinui.BundleResource.java
License:Apache License
/** * Gets the MIME type of this resource.// ww w . ja va 2 s . co m * * @see com.vaadin.server.Resource#getMIMEType() */ @Override public String getMIMEType() { return (FileTypeResolver.getMIMEType(resourceName)); }